Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

WebElement.isDisplayed() throws NoSuchElementException when element is not found #1880

@lukeis

Description

@lukeis

Originally reported on Google Code with ID 1880

What steps will reproduce the problem?

WebElement myElement;
myElement.isDisplayed();


What is the expected output? What do you see instead?

This code returns true if the element is found. However if the element is not found
this code DOES NOT return false. Instead NoSuchElementException is thrown.


What version of the product are you using? On what operating system?

Selenium 2.0 rc2, Java.

Please provide any additional information below.

Work-around it to wrap this in a try catch. However isDisplayed() should follow it's
contract and return a boolean always. Users will need a try-catch whenever they care
about isDisplayed returning false.

Reported by writewale on 2011-06-20 19:32:45

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions