Selenium Webdriver code in Java to search hidden Objects in Web Browser
I am trying to create a Selenium Web driver java code where I can find all the hidden objects on the webpage and can be accessed. I want the count of all those hidden objects. Which property I can use in the code which can identify hidden objects because when I thought of using get Element by property so that i can search for objects with hidden property, it was not there. Is there anything i am missing here. Is it really possible ? Or do we need to know the id of the element to be found ? Any Inputs will be useful.
What kind of hidden objects are you looking for? If it's any HTML tags with the attribute
display: none;try using
List elements = driver.findElements(By.cssSelector("[display=none]")); int count = elements.size();
This uses CSS matching to find all HTML elements with the display attribute equal to none. Then get the size of the returned list with the