Utility to check element present or not
See original GitHub issueMeta -
OS: Any
Selenium Version: 2.53
Browser: chrome
Browser Version: 50.0.2661.94 m
Expected Behavior -
It’s better to have an utility method (inside selenium api) which will allow us to check particular web element is present or not. Please let me know if there is any api available already.
Actual Behavior -
we need to get elements(instead of element) then we need to check the size of the elements, like below.
List<WebElement> elements=driver.findElements(By.className("myCSS"));
if(elements.size()>=1){
--do some operation
}
Steps to reproduce -
Get an element, and check whether it exists or not.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Verifying whether an element present or visible in Selenium ...
To check the visibility of an element in a page, the method isDisplayed is used. It returns a Boolean value( true is returned...
Read more >Test if an element is present using Selenium WebDriver
To find if a particular Element is present or not, we have to use the findElements() method instead of findElement ...
Read more >Verifying whether an element present or visible in ... - Edureka
The isDisplayed method in Selenium verifies if a certain element is present and displayed. If the element is displayed, then the value returned ......
Read more >assertElementPresent, verifyElementPresent - Selenium IDE
In the UI.Vision RPA IDE assertElementPresent is technically like a Click command with the click, it just checks if element is present. This...
Read more >How to Check If an Element Exists in Selenium | Testim Blog
Verifying the existence of an element on a page is a common use case for a browser automation tool. In this post, we've...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#explicit-waits
we have the ExpectedConditions utility class to do just this.