Deep Value Deep Value - 2 years ago 91
Python Question

Tab on Website is "Not Clickable" Using Selenium w/ Python

I'm trying to use Selenium to click the tab for quarterly financials on this page:

When I run my code, it works some of the time, and sometime it tells me:

"Element is not clickable at point (897.7999877929688, 20.100006103515625). Other element would receive the click:

<span class="mectrlname mectrlsignin"></span>"

Here is the code I am running...

from selenium import webdriver
from import By
from import WebDriverWait
from import expected_conditions as EC
from selenium.common.exceptions import *
from selenium.webdriver.common.keys import Keys
import time

driver = webdriver.Firefox()

wait = WebDriverWait(driver, 3)
qtrtab = wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="financials-period-list"]/li[2]')))

Does anyone know why sometimes I get the error message and other times it works just fine? Should I be doing this differently? Thanks!

Answer Source

There is a "frozen" header that covers the element you want to click when the cursor is moved to it. Just maximize the browser window to avoid this problem:

driver = webdriver.Firefox()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download