2

I am trying to use python and selenium to go to a website to collect some data, but I can't even get past the initial popup asking me to click an Accept button to agree to the terms of use! The website is here

I can see that the 'Accept' link/div has an id and I've tried using find_element_by_xpath and selecting the id then attempting to click, but that doesn't work.

I've also tried using ActionChains to navigate to the button and clicking, but that doesn't work either. The error it returns is element is not clickable at point...

There appears to be some jquery/javascript going on in the background which is proving difficult to deal with!

Any help would be greatly appreciated.

1 Answer 1

4

The trick is to wait for the "Accept" button to become clickable, move to the button and click:

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


driver = webdriver.Firefox()
driver.get("https://www.etfsecurities.com/institutional/uk/en-gb/products.aspx")

wait = WebDriverWait(driver, 10)
accept = wait.until(EC.element_to_be_clickable((By.ID, "btnPopupAccept")))

actions = ActionChains(driver)
actions.move_to_element(accept).click().perform()
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you!! Worked perfectly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.