Skip to content

Commit db79088

Browse files
HPRichardlukeis
authored andcommitted
When Selenium is unable to interact with an element, such as the case when an element is missing or disabled, this change will output exactly how Selenium is attempting to locate the element, such as the XPath or id of the element. This greatly speeds up troubleshooting issues, as the exception message clearly states what element is broken/missing for common problems like an ElementNotFoundException.
Signed-off-by: Luke Inman-Semerau <[email protected]>
1 parent d52c0fe commit db79088

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,9 @@ protected Response execute(String driverCommand, Map<String, ?> parameters) {
598598
try {
599599
errorHandler.throwIfResponseFailed(response, System.currentTimeMillis() - start);
600600
} catch (WebDriverException ex) {
601+
if (parameters != null && parameters.containsKey("using") && parameters.containsKey("value")) {
602+
ex.addInfo("*** Element info", String.format("{Using=%s, value=%s}", parameters.get("using"), parameters.get("value")));
603+
}
601604
ex.addInfo(WebDriverException.DRIVER_INFO, this.getClass().getName());
602605
if (getSessionId() != null) {
603606
ex.addInfo(WebDriverException.SESSION_ID, getSessionId().toString());

0 commit comments

Comments
 (0)