Skip to content

Commit a1bf9e0

Browse files
authored
Merge branch 'trunk' into add-jspecify-annotations-by
2 parents 10a7219 + c3dd52e commit a1bf9e0

File tree

21 files changed

+1062
-650
lines changed

21 files changed

+1062
-650
lines changed

.github/workflows/stage-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
env:
88
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
910

1011
jobs:
1112
github-release:
@@ -20,7 +21,6 @@ jobs:
2021
- name: Extract version from branch name
2122
id: extract_version
2223
run: |
23-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
2424
VERSION=$(echo $BRANCH_NAME | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
2525
echo "VERSION=$VERSION" >> $GITHUB_ENV
2626
- name: Prep git

.skipped-tests

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-//javascript/atoms:test-chrome
2020
-//javascript/atoms:test-edge
2121
-//javascript/atoms:test-firefox-beta
22+
-//javascript/chrome-driver/...
2223
-//javascript/node/selenium-webdriver:test-bidi-network-test.js-chrome
2324
-//javascript/node/selenium-webdriver:test-builder-test.js-chrome
2425
-//javascript/node/selenium-webdriver:test-builder-test.js-firefox
@@ -54,3 +55,4 @@
5455
-//rb/spec/integration/selenium/webdriver:element-chrome
5556
-//rb/spec/integration/selenium/webdriver:element-chrome-bidi
5657
-//rb/spec/integration/selenium/webdriver:element-chrome-remote
58+
-//rust/tests/...

common/src/web/javascriptPage.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ <h1>Type Stuff</h1>
279279
</div>
280280
</div>
281281

282+
<form id="aParentFormId">
283+
<input type="text" name="tagName">
284+
</form>
285+
282286
</body>
283287
</html>
284288

java/src/org/openqa/selenium/JavascriptExecutor.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.util.Collections;
2121
import java.util.Set;
2222
import java.util.stream.Collectors;
23+
import org.jspecify.annotations.NullMarked;
24+
import org.jspecify.annotations.Nullable;
2325
import org.openqa.selenium.internal.Require;
2426

2527
/**
@@ -30,6 +32,7 @@
3032
* request or when trying to access another frame. Most times when troubleshooting failure it's best
3133
* to view the browser's console after executing the WebDriver request.
3234
*/
35+
@NullMarked
3336
public interface JavascriptExecutor {
3437
/**
3538
* Executes JavaScript in the context of the currently selected frame or window. The script
@@ -63,7 +66,7 @@ public interface JavascriptExecutor {
6366
* @param args The arguments to the script. May be empty
6467
* @return One of Boolean, Long, Double, String, List, Map or WebElement. Or null.
6568
*/
66-
Object executeScript(String script, Object... args);
69+
@Nullable Object executeScript(String script, @Nullable Object... args);
6770

6871
/**
6972
* Execute an asynchronous piece of JavaScript in the context of the currently selected frame or
@@ -139,7 +142,7 @@ public interface JavascriptExecutor {
139142
* @return One of Boolean, Long, String, List, Map, WebElement, or null.
140143
* @see WebDriver.Timeouts#scriptTimeout(java.time.Duration)
141144
*/
142-
Object executeAsyncScript(String script, Object... args);
145+
@Nullable Object executeAsyncScript(String script, @Nullable Object... args);
143146

144147
/**
145148
* Commonly used scripts may be "pinned" to the WebDriver session, allowing them to be called
@@ -186,7 +189,7 @@ default Set<ScriptKey> getPinnedScripts() {
186189
*
187190
* @see #executeScript(String, Object...)
188191
*/
189-
default Object executeScript(ScriptKey key, Object... args) {
192+
default @Nullable Object executeScript(ScriptKey key, @Nullable Object... args) {
190193
Require.stateCondition(
191194
key instanceof UnpinnedScriptKey, "Script key should have been generated by this driver");
192195

java/src/org/openqa/selenium/OutputType.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
import java.nio.file.Files;
2323
import java.nio.file.Path;
2424
import java.util.Base64;
25+
import org.jspecify.annotations.NullMarked;
2526

2627
/**
2728
* Defines the output type for a screenshot.
2829
*
2930
* @see TakesScreenshot
3031
* @param <T> Type for the screenshot output.
3132
*/
33+
@NullMarked
3234
public interface OutputType<T> {
3335
/** Obtain the screenshot as base64 data. */
3436
OutputType<String> BASE64 =

java/src/org/openqa/selenium/TakesScreenshot.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package org.openqa.selenium;
1818

19+
import org.jspecify.annotations.NullMarked;
20+
1921
/**
2022
* Indicates a driver or an HTML element that can capture a screenshot and store it in different
2123
* ways.
@@ -29,6 +31,7 @@
2931
*
3032
* @see OutputType
3133
*/
34+
@NullMarked
3235
public interface TakesScreenshot {
3336
/**
3437
* Capture the screenshot and store it in the specified location.

java/src/org/openqa/selenium/WebDriver.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import java.util.List;
2323
import java.util.Set;
2424
import java.util.concurrent.TimeUnit;
25+
import org.jspecify.annotations.NullMarked;
26+
import org.jspecify.annotations.Nullable;
2527
import org.openqa.selenium.logging.LoggingPreferences;
2628
import org.openqa.selenium.logging.Logs;
2729

@@ -46,6 +48,7 @@
4648
* <p>Most implementations of this interface follow <a href="https://w3c.github.io/webdriver/">W3C
4749
* WebDriver specification</a>
4850
*/
51+
@NullMarked
4952
public interface WebDriver extends SearchContext {
5053
// Navigation
5154

@@ -74,7 +77,7 @@ public interface WebDriver extends SearchContext {
7477
*
7578
* @return The URL of the page currently loaded in the browser
7679
*/
77-
String getCurrentUrl();
80+
@Nullable String getCurrentUrl();
7881

7982
// General properties
8083

@@ -87,7 +90,7 @@ public interface WebDriver extends SearchContext {
8790
* @return The title of the current page, with leading and trailing whitespace stripped, or null
8891
* if one is not already set
8992
*/
90-
String getTitle();
93+
@Nullable String getTitle();
9194

9295
/**
9396
* Find all elements within the current page using the given mechanism. This method is affected by
@@ -142,7 +145,7 @@ public interface WebDriver extends SearchContext {
142145
*
143146
* @return The source of the current page
144147
*/
145-
String getPageSource();
148+
@Nullable String getPageSource();
146149

147150
/**
148151
* Close the current window, quitting the browser if it's the last window currently open.
@@ -261,7 +264,7 @@ interface Options {
261264
* @param name the name of the cookie
262265
* @return the cookie, or null if no cookie with the given name is present
263266
*/
264-
Cookie getCookieNamed(String name);
267+
@Nullable Cookie getCookieNamed(String name);
265268

266269
/**
267270
* @return the interface for managing driver timeouts.

javascript/atoms/domcore.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ bot.dom.core.isElement = function (node, opt_tagName) {
169169
if (opt_tagName && (typeof opt_tagName !== 'string')) {
170170
opt_tagName = opt_tagName.toString();
171171
}
172+
// because node.tagName.toUpperCase() fails when tagName is "tagName"
173+
if (node instanceof HTMLFormElement) {
174+
return !!node && node.nodeType == goog.dom.NodeType.ELEMENT &&
175+
(!opt_tagName || "FORM" == opt_tagName);
176+
}
172177
return !!node && node.nodeType == goog.dom.NodeType.ELEMENT &&
173178
(!opt_tagName || node.tagName.toUpperCase() == opt_tagName);
174179
};

py/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ async-generator==1.10
22
attrs==23.2.0
33
certifi==2023.11.17
44
cffi==1.16.0
5-
cryptography==42.0.7
6-
debugpy==1.8.1
5+
cryptography==42.0.8
6+
debugpy==1.8.5
77
h11==0.14.0
88
idna==3.7
99
importlib-metadata==6.8.0

py/selenium/webdriver/common/actions/input_device.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# under the License.
1717

1818
import uuid
19+
from typing import Any
20+
from typing import List
1921
from typing import Optional
2022

2123

@@ -24,14 +26,14 @@ class InputDevice:
2426

2527
def __init__(self, name: Optional[str] = None):
2628
self.name = name or uuid.uuid4()
27-
self.actions = []
29+
self.actions: List[Any] = []
2830

29-
def add_action(self, action):
31+
def add_action(self, action: Any) -> None:
3032
""""""
3133
self.actions.append(action)
3234

33-
def clear_actions(self):
35+
def clear_actions(self) -> None:
3436
self.actions = []
3537

36-
def create_pause(self, duration: int = 0):
38+
def create_pause(self, duration: int = 0) -> None:
3739
pass

0 commit comments

Comments
 (0)