Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

michaelsuzukisagi
Copy link

…a boolean and handle exceptions

} catch (Exception e) {
//ignore and return false to indicate element is not visible.
}
return false;
Copy link
Contributor

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.

@artkoshelev
Copy link
Contributor

test this please

@alkedr
Copy link
Contributor

alkedr commented Sep 7, 2015

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Either log or rethrow this exception. rule

@qatools-ci
Copy link
Member

SonarQube analysis reported 2 issues:

  • CRITICAL 2 critical

Watch the comments in this conversation to review them.

return getWrappedElement().isDisplayed();
try{
return getWrappedElement().isDisplayed();
} catch (Exception e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Either log or rethrow this exception. rule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants