r/selenium • u/Meric_ • Aug 02 '21
Selenium clicks the wrong element
This is an odd bug that's been annoying me for a while. I have selenium move to an element with an action chain, and I can see that it has properly moved there since the selected item is highlighted. However when I tell it to click it somehow clicks an element nearby instead. Any clue as to why?
1
u/throwitout696969691 Aug 02 '21
What are using to select the element? Sometimes there are elements I accidently select because the class is the same or the index for a list element if off
1
u/XabiAlon Aug 02 '21
I'm assuming the reason for using a MoveTo and Action is because it's a hover over element like a JS menu?
Can you share some code?
1
u/AvD3369 Aug 02 '21
If it's a hover action, i would recommend using javascript to select and click on the element.
I would love to help you out more but i need some code or some reference to the website you're trying to automate.
1
u/tbaxterstockman Aug 02 '21
Does it work without selenium? could it be that there is another element overlapping?