Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

find an element using id in requests-html library in 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 element with id 'navbar'
navbar= page_html.find('#navbar')
# printing element
print(navbar)Copy Code
Source by www.alixaprodev.com #
 
PREVIOUS NEXT
Tagged: #find #element #id #library #python
ADD COMMENT
Topic
Name
8+7 =