I am testing a webapp created with python dash using selenium. I am trying to click a tab but always get the ElementClickIntercepted Exception
.
Note: Of course I stumbled over similiar problems but most times the problem is that the element cannot be clicked as is did not load yet - I already built in waits! - or the fact that another element would receive the click which cannot be the case either. Note that the first item is always preselected and i want to choose the second.
#Selct X-Axis
x_axis = driver.find_element(By.XPATH, "//*[@id='navbar']/a[2]")
x_axis.click()
driver.implicitly_wait(2)
try:
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, "//a[text()='Even']"))
)
except:
raise Exception
even= driver.find_element(By.XPATH, "//a[text()='Even']")
even.click()
Exception snapshot:
HTML snapshot:
Based on what you've posted,
By.XPATH, "//a[text()='Even']"
is probably selecting an HTML element different from what you're expecting.There appears to be an
<a>
with text that starts with'Even'
, but you've shown nothing with text that equals'Even'
.BTW, when asking a question, you ought to at least paste the relevant HTML as text, rather than as a screenshot.