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

'isInvisible()' now returns true on 'NoSuchElementException' instead of causing 'TimeoutException' #8063

Merged
merged 2 commits into from
Mar 27, 2020

Conversation

r-sniper
Copy link
Contributor

@r-sniper r-sniper commented Feb 27, 2020

The isInvisible() method, when encountered with
NoSuchElementException causes TimeoutException,
whereas, it should return true.
Because if the element is not present in DOM, it should be treated as invisible

Fixes #7518

Description

The isInvisible() method now catches NoSuchElementException along with
StaleElementReferenceException and returns true for these exceptions.

Motivation and Context

Any element not present in the DOM should be treated as invisible.

In case of element located by @FindBy locator, the element holds ProxyElement and the actual element is looked up only when the element is referenced, and the element is referenced in isInvisible method by checking !element.isDisplayed() condition, which causes timeout exception
when using the element in following manner
new WebDriverWait(driver,Duration.ofSeconds(5)).until(ExpectedConditions.invisibilityOf(element));
even though element is not present.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

The 'isInvisible()' method, when encountered with
'NoSuchElementException' causes 'TimeoutException',
whereas, it should return true.
Because if the element id not in DOM, it should be treated as invisible

Fixes SeleniumHQ#7518
@r-sniper
Copy link
Contributor Author

@claassistantio I did sign the CLA as evident in the below attached image, this PR still shows CLA not signed

image

@jordan-mace
Copy link
Contributor

jordan-mace commented Feb 27, 2020

@r-sniper see the second half of @claassistantio's message. The bot can't identify you as a GitHub user because the email you committed with isn't currently tied to your GitHub account. Updating your profile and then clicking that recheck link should fix it up.

EDIT: You'll also notice that the commit in this PR is tied to your name, and not your actual GitHub profile.

@AutomatedTester
Copy link
Member

@claassistantio I did sign the CLA as evident in the below attached image, this PR still shows CLA not signed

image

Could you please make sure that the information you put into the CLA page matches that of the information you have attached to your github profile. We can then get it merged.

Thank you

@CLAassistant
Copy link

CLAassistant commented Mar 5, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ AutomatedTester
❌ Rahul Shah


Rahul Shah seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@AutomatedTester AutomatedTester merged commit 624731c into SeleniumHQ:master Mar 27, 2020
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.

Selenium WebDriverWait.until(invisiblityOfAllElements) returns timeout on NoSuchElementException
5 participants