Test if element is present using Selenium WebDriver? (Python)
The easiest way to check if an element is present on a web page is to find all the elements matching the element locator and check that the size of the resulting list is not 0.
Selenium doesn't offer any solutions more concise than this due to the nature of element locating.
isPresent = len(self.driver.find_elements_by_name("search")) > 0
Leave a reply
Your email address will not be published. Required fields are marked*