-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It's expected that an element might not be present...
... when waiting for the element to be present. Closes #3552
- Loading branch information
Showing
1 changed file
with
3 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -893,7 +893,9 @@ public String toString() { | |
private static WebElement findElement(By by, WebDriver driver) { | ||
try { | ||
return driver.findElements(by).stream().findFirst().orElseThrow( | ||
() -> new NoSuchElementException("Cannot locate an element using " + by)); | ||
() -> new NoSuchElementException("Cannot locate an element using " + by)); | ||
} catch (NoSuchElementException e) { | ||
throw e; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
valfirst
Contributor
|
||
} catch (WebDriverException e) { | ||
log.log(Level.WARNING, | ||
String.format("WebDriverException thrown by findElement(%s)", by), e); | ||
|
@shs96c I'm rusty on lambdas but doesn't this catch and re-throw the
NoSuchElemenetException
thrown viaorElseThrow
?