Sélectionnez l'élément à l'aide du sélecteur CSS dans Python

# importing the HTMLSession class
from requests_html import HTMLSession
# create the object of the session
session = HTMLSession()
# url of the page
web_page = 'https://webscraper.io/'
# making get request to the webpage
respone = session.get(web_page)
# getting the html of the page
page_html = respone.html
# finding elements with the CSS attribute 'role'
header= page_html.find('[role="banner"]')
# printing the element
print(header) Copy Again
Pythonist