Saturday, 15 April 2023

How do I click on clickable element with Selenium?

An "Agree with the terms" button appears on https://www.sreality.cz/hledani/prodej/domy I am trying to go through that with a .click() using Selenium and Python. The button element is:

<button data-testid="button-agree" type="button" class="scmp-btn scmp-btn--default w-button--footer sm:scmp-ml-sm md:scmp-ml-md lg:scmp-ml-dialog">SouhlasĂ­m</button>

My approach is:

driver = webdriver.Chrome()
driver.implicitly_wait(20)

driver.get("https://www.sreality.cz/hledani/prodej/domy")

button = driver.find_element_by_css_selector("button[data-testid='button-agree']")
button.click()

Any idea what to change to make it work? Thanks! :)



from How do I click on clickable element with Selenium?

No comments:

Post a Comment