this is a strange one (for me) that I can't get my head around.
I have an application, I recorded a basic test with the Selenium IDE and exported this and have tried to make the code more robust. I am having issues with this element:
<input class=" " id="P400_ADD_MEDIUM_BUT" onclick="void(0);" type="button" value="Add Emission">
It should be fairly simple, it has an id so initially I thought I would use this to locate the element and click it:
driver.findElement(By.id("P400_ADD_MEDIUM_BUT")).click();
When I watch the test run, the button is highlighted blue (this application has a two stage blue colour, dark blue when the mouse button is down, lighter blue when mouse released) - the colour I see is light blue - however, nothing happens (a popup should appear.)
I have tried changing this to XPath and using the following: //input[@id='P400_ADD_MEDIUM_BUT']
driver.findElement(By.xpath("//input[@id='P400_ADD_MEDIUM_BUT']")).click();
But still the same result. I played the recorded script back in the IDE and this works fine. I should mention that the test has to run in IE (it's an internal application and IE is the only browser used internally) - but I am stumped.
IE is 11, latest selenium and IE driver.
Anyone have any ideas?
idattribute value is getting changed?driver.get()before you execute yourclick();.