Skip to content

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

Merged
AutomatedTester merged 3 commits intoSeleniumHQ:trunkfrom
symonk:relative-by-error-handling-no-such-element
Nov 30, 2021
Merged

[py] Improved exception handling relative locators that return empty sequences#10078
AutomatedTester merged 3 commits intoSeleniumHQ:trunkfrom
symonk:relative-by-error-handling-no-such-element

Conversation

@symonk
Copy link
Copy Markdown
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
@sonarqubecloud
Copy link
Copy Markdown

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 April 16, 2022 14:09
elgatov pushed a commit to elgatov/selenium that referenced this pull request Jun 27, 2022
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.

2 participants