Skip to content

Commit 5a0ee5c

Browse files
lmtierneyTom-Trumper
authored andcommitted
guarding against null return value from find_elements in python
see issue SeleniumHQ#4555
1 parent f8af761 commit 5a0ee5c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

py/selenium/webdriver/remote/webdriver.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,11 @@ def find_elements(self, by=By.ID, value=None):
861861
by = By.CSS_SELECTOR
862862
value = '[name="%s"]' % value
863863

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

868870
@property
869871
def desired_capabilities(self):

0 commit comments

Comments
 (0)