|
20 | 20 | import java.util.Collections; |
21 | 21 | import java.util.Set; |
22 | 22 | import java.util.stream.Collectors; |
| 23 | +import org.jspecify.annotations.NullMarked; |
| 24 | +import org.jspecify.annotations.Nullable; |
23 | 25 | import org.openqa.selenium.internal.Require; |
24 | 26 |
|
25 | 27 | /** |
|
30 | 32 | * request or when trying to access another frame. Most times when troubleshooting failure it's best |
31 | 33 | * to view the browser's console after executing the WebDriver request. |
32 | 34 | */ |
| 35 | +@NullMarked |
33 | 36 | public interface JavascriptExecutor { |
34 | 37 | /** |
35 | 38 | * Executes JavaScript in the context of the currently selected frame or window. The script |
@@ -63,7 +66,7 @@ public interface JavascriptExecutor { |
63 | 66 | * @param args The arguments to the script. May be empty |
64 | 67 | * @return One of Boolean, Long, Double, String, List, Map or WebElement. Or null. |
65 | 68 | */ |
66 | | - Object executeScript(String script, Object... args); |
| 69 | + @Nullable Object executeScript(String script, @Nullable Object... args); |
67 | 70 |
|
68 | 71 | /** |
69 | 72 | * Execute an asynchronous piece of JavaScript in the context of the currently selected frame or |
@@ -139,7 +142,7 @@ public interface JavascriptExecutor { |
139 | 142 | * @return One of Boolean, Long, String, List, Map, WebElement, or null. |
140 | 143 | * @see WebDriver.Timeouts#scriptTimeout(java.time.Duration) |
141 | 144 | */ |
142 | | - Object executeAsyncScript(String script, Object... args); |
| 145 | + @Nullable Object executeAsyncScript(String script, @Nullable Object... args); |
143 | 146 |
|
144 | 147 | /** |
145 | 148 | * Commonly used scripts may be "pinned" to the WebDriver session, allowing them to be called |
@@ -186,7 +189,7 @@ default Set<ScriptKey> getPinnedScripts() { |
186 | 189 | * |
187 | 190 | * @see #executeScript(String, Object...) |
188 | 191 | */ |
189 | | - default Object executeScript(ScriptKey key, Object... args) { |
| 192 | + default @Nullable Object executeScript(ScriptKey key, @Nullable Object... args) { |
190 | 193 | Require.stateCondition( |
191 | 194 | key instanceof UnpinnedScriptKey, "Script key should have been generated by this driver"); |
192 | 195 |
|
|
0 commit comments