Skip to content

Commit

Permalink
Defending against chromedriver that sometimes returns null value as t…
Browse files Browse the repository at this point in the history
…he result of findElements operation. See #4555
  • Loading branch information
barancev committed Aug 24, 2017
1 parent 1940813 commit 4a3ec2d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@

import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashSet;
Expand Down Expand Up @@ -442,6 +443,9 @@ protected List<WebElement> findElements(String by, String using) {
Response response = execute(DriverCommand.FIND_ELEMENTS,
ImmutableMap.of("using", by, "value", using));
Object value = response.getValue();
if (value == null) { // see https://github.com/SeleniumHQ/selenium/issues/4555
return Collections.emptyList();
}
List<WebElement> allElements;
try {
allElements = (List<WebElement>) value;
Expand Down

0 comments on commit 4a3ec2d

Please sign in to comment.