|
18 | 18 |
|
19 | 19 | /**
|
20 | 20 | * Indicates that a driver can execute JavaScript, providing access to the mechanism to do so.
|
| 21 | + * |
| 22 | + * <p> |
| 23 | + * Because of cross domain policies browsers enforce your script execution may fail unexpectedly |
| 24 | + * and without adequate error messaging. This is particularly pertinent when creating your own |
| 25 | + * XHR request or when trying to access another frame. Most times when troubleshooting failure it's |
| 26 | + * best to view the browser's console after executing the WebDriver request. |
21 | 27 | */
|
22 | 28 | public interface JavascriptExecutor {
|
23 | 29 | /**
|
@@ -76,6 +82,13 @@ public interface JavascriptExecutor {
|
76 | 82 | * support nested lists.</li>
|
77 | 83 | * <li>Unless the value is null or there is no return value, in which null is returned</li>
|
78 | 84 | * </ul>
|
| 85 | + * |
| 86 | + * <p> |
| 87 | + * The default timeout for a script to be executed is 0ms. In most cases, including the examples |
| 88 | + * below, one must set the script timeout |
| 89 | + * {@link WebDriver.Timeouts#setScriptTimeout(long, java.util.concurrent.TimeUnit)} beforehand |
| 90 | + * to a value sufficiently large enough. |
| 91 | + * |
79 | 92 | *
|
80 | 93 | * <p>
|
81 | 94 | * Example #1: Performing a sleep in the browser under test. <code><pre>
|
@@ -119,9 +132,11 @@ public interface JavascriptExecutor {
|
119 | 132 | * criteria. The arguments will be made available to the JavaScript via the "arguments"
|
120 | 133 | * variable.
|
121 | 134 | *
|
| 135 | + * |
122 | 136 | * @param script The JavaScript to execute.
|
123 | 137 | * @param args The arguments to the script. May be empty.
|
124 | 138 | * @return One of Boolean, Long, String, List, WebElement, or null.
|
| 139 | + * @see WebDriver.Timeouts#setScriptTimeout(long, java.util.concurrent.TimeUnit) |
125 | 140 | */
|
126 | 141 | Object executeAsyncScript(String script, Object... args);
|
127 | 142 | }
|
0 commit comments