Skip to content

Commit

Permalink
guarding against null return value from find_elements in python
Browse files Browse the repository at this point in the history
see issue #4555
  • Loading branch information
lmtierney committed Sep 1, 2017
1 parent 68c2432 commit 4fcce6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion py/selenium/webdriver/remote/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,9 +861,11 @@ def find_elements(self, by=By.ID, value=None):
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

# Return empty list if driver returns null
# See https://github.com/SeleniumHQ/selenium/issues/4555
return self.execute(Command.FIND_ELEMENTS, {
'using': by,
'value': value})['value']
'value': value})['value'] or []

@property
def desired_capabilities(self):
Expand Down

0 comments on commit 4fcce6e

Please sign in to comment.