Skip to content

Commit 3b8573b

Browse files
authored
Merge branch 'trunk' into bidi_add_authentication_handler
2 parents 81bb508 + 431c412 commit 3b8573b

File tree

20 files changed

+178
-65
lines changed

20 files changed

+178
-65
lines changed

.github/workflows/ci-python.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,4 @@ jobs:
9696
browser: safari
9797
os: macos
9898
cache-key: py-safari
99-
run: |
100-
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-safari-test/selenium/webdriver/safari/launcher_tests.py
99+
run: bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-safari

java/src/org/openqa/selenium/grid/node/ForwardWebDriverCommand.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
package org.openqa.selenium.grid.node;
1919

20-
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
20+
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
2121
import static org.openqa.selenium.remote.HttpSessionId.getSessionId;
2222
import static org.openqa.selenium.remote.http.Contents.asJson;
2323

24-
import com.google.common.collect.ImmutableMap;
24+
import java.util.Map;
2525
import org.openqa.selenium.internal.Require;
2626
import org.openqa.selenium.remote.SessionId;
2727
import org.openqa.selenium.remote.http.HttpHandler;
@@ -48,10 +48,16 @@ public HttpResponse execute(HttpRequest req) {
4848
return node.executeWebDriverCommand(req);
4949
}
5050
return new HttpResponse()
51-
.setStatus(HTTP_INTERNAL_ERROR)
51+
.setStatus(HTTP_NOT_FOUND)
5252
.setContent(
5353
asJson(
54-
ImmutableMap.of(
55-
"error", String.format("Session not found in node %s", node.getId()))));
54+
Map.of(
55+
"value",
56+
Map.of(
57+
"error", "invalid session id",
58+
"message",
59+
"Cannot find session with id: "
60+
+ getSessionId(req.getUri()).orElse(null),
61+
"stacktrace", ""))));
5662
}
5763
}

java/src/org/openqa/selenium/grid/node/Node.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,7 @@ protected Node(
154154
combine(
155155
// "getSessionId" is aggressive about finding session ids, so this needs to be the last
156156
// route that is checked.
157-
matching(
158-
req ->
159-
getSessionId(req.getUri())
160-
.map(SessionId::new)
161-
.map(sessionId -> this.getSession(sessionId) != null)
162-
.orElse(false))
157+
matching(req -> getSessionId(req.getUri()).map(SessionId::new).isPresent())
163158
.to(() -> new ForwardWebDriverCommand(this))
164159
.with(spanDecorator("node.forward_command")),
165160
new CustomLocatorHandler(this, registrationSecret, customLocators),

java/src/org/openqa/selenium/netty/server/RequestConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Ex
9696
length = -1;
9797
}
9898

99-
if (msg instanceof HttpContent) {
99+
if (request != null && msg instanceof HttpContent) {
100100
ByteBuf buf = ((HttpContent) msg).content().retain();
101101
int nBytes = buf.readableBytes();
102102

java/test/org/openqa/selenium/grid/node/ForwardWebDriverCommandTest.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
package org.openqa.selenium.grid.node;
1919

20-
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
20+
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
2121
import static org.junit.jupiter.api.Assertions.assertEquals;
2222
import static org.mockito.Mockito.*;
2323
import static org.openqa.selenium.remote.http.Contents.asJson;
2424

25-
import com.google.common.collect.ImmutableMap;
25+
import java.util.Map;
2626
import java.util.UUID;
2727
import org.junit.jupiter.api.BeforeEach;
2828
import org.junit.jupiter.api.Test;
@@ -69,11 +69,18 @@ void testExecuteWithInvalidSessionOwner() {
6969
HttpResponse actualResponse = command.execute(mockRequest);
7070
HttpResponse expectResponse =
7171
new HttpResponse()
72-
.setStatus(HTTP_INTERNAL_ERROR)
72+
.setStatus(HTTP_NOT_FOUND)
7373
.setContent(
7474
asJson(
75-
ImmutableMap.of(
76-
"error", String.format("Session not found in node %s", mockNode.getId()))));
75+
Map.of(
76+
"value",
77+
Map.of(
78+
"error",
79+
"invalid session id",
80+
"message",
81+
"Cannot find session with id: " + sessionId,
82+
"stacktrace",
83+
""))));
7784
assertEquals(expectResponse.getStatus(), actualResponse.getStatus());
7885
assertEquals(expectResponse.getContentEncoding(), actualResponse.getContentEncoding());
7986
}

java/test/org/openqa/selenium/grid/router/StressTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ public void setupServers() {
7777
+ "\n"
7878
+ "session-timeout = 11"
7979
+ "\n"
80+
+ "overwrite-max-sessions = true"
81+
+ "\n"
82+
+ "max-sessions = "
83+
+ Runtime.getRuntime().availableProcessors() * 2
84+
+ "\n"
8085
+ "enable-managed-downloads = true")));
8186
tearDowns.add(deployment);
8287

py/selenium/webdriver/remote/webelement.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ def get_attribute(self, name) -> str | None:
173173
# Check if the "active" CSS class is applied to an element.
174174
is_active = "active" in target_element.get_attribute("class")
175175
"""
176+
177+
warnings.warn(
178+
"using WebElement.get_attribute() has been deprecated. Please use get_dom_attribute() instead.",
179+
DeprecationWarning,
180+
stacklevel=2,
181+
)
182+
176183
if getAttribute_js is None:
177184
_load_js()
178185
attribute_value = self.parent.execute_script(

py/test/selenium/webdriver/common/alerts_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ def test_alert_should_not_allow_additional_commands_if_dismissed(driver, pages):
294294
@pytest.mark.xfail_remote(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1279211")
295295
@pytest.mark.xfail_chrome
296296
@pytest.mark.xfail_edge
297+
@pytest.mark.xfail_safari
297298
def test_unexpected_alert_present_exception_contains_alert_text(driver, pages):
298299
pages.load("alerts.html")
299300
driver.find_element(by=By.ID, value="alert").click()

py/test/selenium/webdriver/common/api_example_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def test_is_element_displayed(driver, pages):
240240

241241

242242
@pytest.mark.xfail_chrome
243+
@pytest.mark.xfail_safari
243244
def test_move_window_position(driver, pages):
244245
pages.load("blank.html")
245246
loc = driver.get_window_position()

py/test/selenium/webdriver/common/interactions_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ def test_can_pause(driver, pages):
253253

254254
@pytest.mark.xfail_firefox
255255
@pytest.mark.xfail_remote
256+
@pytest.mark.xfail_safari
256257
def test_can_scroll_to_element(driver, pages):
257258
pages.load("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html")
258259
iframe = driver.find_element(By.TAG_NAME, "iframe")
@@ -266,6 +267,7 @@ def test_can_scroll_to_element(driver, pages):
266267

267268
@pytest.mark.xfail_firefox
268269
@pytest.mark.xfail_remote
270+
@pytest.mark.xfail_safari
269271
def test_can_scroll_from_element_by_amount(driver, pages):
270272
pages.load("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html")
271273
iframe = driver.find_element(By.TAG_NAME, "iframe")
@@ -280,6 +282,7 @@ def test_can_scroll_from_element_by_amount(driver, pages):
280282

281283
@pytest.mark.xfail_firefox
282284
@pytest.mark.xfail_remote
285+
@pytest.mark.xfail_safari
283286
def test_can_scroll_from_element_with_offset_by_amount(driver, pages):
284287
pages.load("scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html")
285288
footer = driver.find_element(By.TAG_NAME, "footer")
@@ -314,6 +317,7 @@ def test_can_scroll_from_viewport_by_amount(driver, pages):
314317
assert _in_viewport(driver, footer)
315318

316319

320+
@pytest.mark.xfail_safari
317321
def test_can_scroll_from_viewport_with_offset_by_amount(driver, pages):
318322
pages.load("scrolling_tests/frame_with_nested_scrolling_frame.html")
319323
scroll_origin = ScrollOrigin.from_viewport(10, 10)

0 commit comments

Comments
 (0)