The Wayback Machine - https://web.archive.org/web/20221028021034/https://github.com/SeleniumHQ/selenium/pull/10078
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

[py] Improved exception handling relative locators that return empty sequences #10078

Conversation

symonk
Copy link
Member

@symonk symonk commented Nov 23, 2021

When using driver.find_element(...) with a RelativeBy type, an IndexError could be raised, this patch raises a NoSuchElementException in the event that the call to find_elements(...) returns an empty sequence, rather than a sequence of web elements. I could use some steer here in terms of what the message should be; and instances where root may be None ?

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. (N/A)
  • I have updated the documentation accordingly. (N/A)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@AutomatedTester AutomatedTester merged commit c188fe8 into SeleniumHQ:trunk Nov 30, 2021
16 checks passed
@sonarcloud
Copy link

sonarcloud bot commented Nov 30, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@symonk symonk deleted the relative-by-error-handling-no-such-element branch Apr 16, 2022
elgatov pushed a commit to elgatov/selenium that referenced this pull request Jun 27, 2022
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants