diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
index e7bedf3377d40..3572571ad83c3 100644
--- a/.idea/copyright/profiles_settings.xml
+++ b/.idea/copyright/profiles_settings.xml
@@ -1,3 +1,5 @@
-
+
+
+
\ No newline at end of file
diff --git a/java/client/src/org/openqa/selenium/support/ui/BUCK b/java/client/src/org/openqa/selenium/support/ui/BUCK
index 09d01682c191c..42f4c31b6dcc5 100644
--- a/java/client/src/org/openqa/selenium/support/ui/BUCK
+++ b/java/client/src/org/openqa/selenium/support/ui/BUCK
@@ -46,6 +46,7 @@ java_library(name = 'wait',
deps = [
':clock',
'//java/client/src/org/openqa/selenium:webdriver-api',
+ '//java/client/src/org/openqa/selenium/remote:remote',
'//third_party/java/guava-libraries:guava-libraries',
],
visibility = ['PUBLIC'],
diff --git a/java/client/src/org/openqa/selenium/support/ui/WebDriverWait.java b/java/client/src/org/openqa/selenium/support/ui/WebDriverWait.java
index 7eba25fdd09d9..33257b8d605b4 100644
--- a/java/client/src/org/openqa/selenium/support/ui/WebDriverWait.java
+++ b/java/client/src/org/openqa/selenium/support/ui/WebDriverWait.java
@@ -17,7 +17,10 @@
package org.openqa.selenium.support.ui;
import org.openqa.selenium.NotFoundException;
+import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebDriverException;
+import org.openqa.selenium.remote.RemoteWebDriver;
import java.util.concurrent.TimeUnit;
@@ -26,6 +29,7 @@
*/
public class WebDriverWait extends FluentWait {
public final static long DEFAULT_SLEEP_TIMEOUT = 500;
+ private final WebDriver driver;
/**
* Wait will ignore instances of NotFoundException that are encountered (thrown) by default in
@@ -67,5 +71,22 @@ protected WebDriverWait(WebDriver driver, Clock clock, Sleeper sleeper, long tim
withTimeout(timeOutInSeconds, TimeUnit.SECONDS);
pollingEvery(sleepTimeOut, TimeUnit.MILLISECONDS);
ignoring(NotFoundException.class);
+ this.driver = driver;
+ }
+
+ @Override
+ protected RuntimeException timeoutException(String message, Throwable lastException) {
+ TimeoutException ex = new TimeoutException(message, lastException);
+ ex.addInfo(WebDriverException.DRIVER_INFO, driver.getClass().getName());
+ if (driver instanceof RemoteWebDriver) {
+ RemoteWebDriver remote = (RemoteWebDriver) driver;
+ if (remote.getSessionId() != null) {
+ ex.addInfo(WebDriverException.SESSION_ID, remote.getSessionId().toString());
+ }
+ if (remote.getCapabilities() != null) {
+ ex.addInfo("Capabilities", remote.getCapabilities().toString());
+ }
+ }
+ throw ex;
}
}
diff --git a/java/client/src/org/openqa/selenium/support/ui/build.desc b/java/client/src/org/openqa/selenium/support/ui/build.desc
index ffc1602dddbcb..19002016e99f0 100644
--- a/java/client/src/org/openqa/selenium/support/ui/build.desc
+++ b/java/client/src/org/openqa/selenium/support/ui/build.desc
@@ -49,5 +49,6 @@ java_library(name = "wait",
deps = [
":clock",
"//java/client/src/org/openqa/selenium:webdriver-api",
+ "//java/client/src/org/openqa/selenium/remote:remote",
"//third_party/java/guava-libraries",
])