url = 'site url'
driver.get(url)
# I'll connect it like this
page = driver.page_source
html = BeautifulSoup(page, 'html.parser')
find_tag = html.findAll('h3')
# h3 tag is the name of the sites that are exposed after searching keywords on Google
# You are about to enter the first site with the word TEST TITLE at the end of the searched site name.
for title in find_tag:
title_name = title.text[-10:]
if title_name == 'TEST TITLE':
The coding that I want is
I'd like to click on the site that corresponds to this place to fill it out.
I approached the xpath of each title location and gave a click event to the for statement in the div[] where the number changes, but when I looked more closely, the xpath structure of the title location (where h3 is located) of the Google site was different Is there any other way I can click on the site when I find TEST TITLE in that state?
python selenium selenium-webdrive beautifulsoup crawling
How to click from xpath
btn = browser.find_elements_by_xpath("XPATH")[0]
btn.click()
© 2024 OneMinuteCode. All rights reserved.