I m trying to build a selenium automation. But i can't pass this problem :
I am trying to click an icon called Data inside of a webpage, but when adress the element, the code clicks another element.
This is the html source of the element:
<a id="EPM_CA_3_3" class="app-nav-label top-nav-label" tabindex="0">Data</a>
When the code is executed it clicks another element.
This is the html source of the WRONG element:
<a id="EPM_CA_2_0" class="app-nav-label top-nav-label" tabindex="0">Tasks</a>
And here is screenshot of the elements (correct and wrong one) elements of the screen
As you can see that both of element has different text even so the code runs incorrectly.
And here is my python code:
try:
elementinside = '//a[text() ="Data"]'
databutton = WebDriverWait(self.driver, 10).until(
EC.presence_of_element_located((By.XPATH, elementinside)))
element = self.driver.find_element(By.XPATH,elementinside)
# element.click()
actions = ActionChains(self.driver)
actions.move_to_element(element).click().perform()
except TimeoutException:
print("signing in fail!")
I couldn't find out any answer from internet. Please assist.