I have been tasked with writing a parser to click a button on a website and I am having issues to click only one of the buttons. The following code works on every button except one.
Here's the html: http://pastebin.com/6dLF5ru8
here's the source html: http://pastebin.com/XhsedGLb
python code:
driver = webdriver.Firefox()
...
el = driver.find_element_by_id("-spel-nba")
actions.move_to_element(el)
actions.sleep(.1)
actions.click()
actions.perform()
I am getting this error.
ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with
as per Saifur I just tried waits with the same element not visible exception:
wait = WebDriverWait(driver, 10)
wait.until(EC.presence_of_element_located((By.XPATH, "//input[contains(@id,'spsel')][@value='nba']"))).click()
findelements
with same selector and see how many elements it returns. I wonder if there are any hidden elements with same selector. It's a very common issue – Dactylexplcit
wait before this likewait = WebDriverWait(driver, 10) wait.until(EC.presence_of_element_located((By.XPATH, "//input[contains(@id,'spsel')][@value='nba']")))
– Dactyliframe
on this page? – DactylEC
? and may ask the you the reason of not usingclick()
? – Dactyldriver = webdriver.Firefox() ... wait = WebDriverWait(driver, 10) wait.until(EC.presence_of_element_located((By.XPATH, "//div[@class='sport-selectors']//input[contains(@id,'spsel')][@value='nba']"))).click() driver.find_element_by_xpath("//div[@class='sport-selectors']//input[contains(@id,'spsel')][@value='nba']").click()
– Dactyl