ambil elemen berdasarkan teks dari halaman html di 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 based on text
p_tag_with_text= page_html.find('p',containing='web data extraction')
# printing the element
print(p_tag_with_text)
Copy Code
Pythonist