-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update default method to check if element displayed to always return … #83
base: master
Are you sure you want to change the base?
Conversation
…a boolean and handle exceptions
} catch (Exception e) { | ||
//ignore and return false to indicate element is not visible. | ||
} | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you're presuming that if element isn't found (this is when exception is thrown), then it's invisible. But this is hiding that fact (that element wasn't found) from the developer who runs the tests and therefore I think it's not the right way to handle this.
Instead you should be catching that exception in place where you call isDisplayed
method.
test this please |
…d to always return and added unit test
I think it would be better to add separate method for that. See PR #91. |
@@ -208,7 +208,12 @@ public WebElement findElement(By by) { | |||
*/ | |||
@Override | |||
public boolean isDisplayed() { | |||
return wrappedElement.isDisplayed(); | |||
try{ | |||
return getWrappedElement().isDisplayed(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return getWrappedElement().isDisplayed(); | ||
try{ | ||
return getWrappedElement().isDisplayed(); | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
58b45bf
to
1c8583b
Compare
…a boolean and handle exceptions