If the object has an ID that is the same as another element, you can use an xpath to find the specific element. Using chrome developer tools and inspect element a lot of the times a object has this attribute type="hidden" if that is the case you can do something like this for a locator object.

By hiddenObj = By.xpath("//*[@id='idOfYourHiddenElement' and @type='hidden']");

This would get your locator even if the id idOfYourHiddenElement is used by some other non-hidden element.

If the hidden object does not have that hidden attribute you can use the Chrome Developer tools

Go to Chrome Menu -> More Tools -> Developer Tools and click the Console tab.

Type this into the console:


As long as chrome is using the right frame, it should find both of your objects. An easy way to find a difference between the two is open up each element and copy paste all attributes into something like notepad++ to auto compare them. Once you find what the difference is you should use that as the second part of your xpath instead of type='hidden'.

Source link https://sqa.stackexchange.com/questions/25990/-hidden--in-


Please enter your comment!
Please enter your name here