Skip to content

Commit 7e19fdc

Browse files
authored
Merge branch 'trunk' into interface_ip
2 parents b61ae07 + f666c7f commit 7e19fdc

File tree

30 files changed

+353
-44
lines changed

30 files changed

+353
-44
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ py/docs/source/**/*
7878
py/build/
7979
py/LICENSE
8080
py/pytestdebug.log
81+
py/python.iml
8182
selenium.egg-info/
8283
third_party/java/jetty/jetty-repacked.jar
8384
*.user

MODULE.bazel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module(name = "selenium")
22

33
bazel_dep(name = "apple_rules_lint", version = "0.4.0")
4-
bazel_dep(name = "aspect_bazel_lib", version = "2.7.9")
5-
bazel_dep(name = "aspect_rules_esbuild", version = "0.20.1")
6-
bazel_dep(name = "aspect_rules_js", version = "1.42.3")
7-
bazel_dep(name = "aspect_rules_ts", version = "2.4.2")
4+
bazel_dep(name = "aspect_bazel_lib", version = "2.8.1")
5+
bazel_dep(name = "aspect_rules_esbuild", version = "0.21.0")
6+
bazel_dep(name = "aspect_rules_js", version = "2.0.1")
7+
bazel_dep(name = "aspect_rules_ts", version = "3.1.0")
88
bazel_dep(name = "bazel_features", version = "1.13.0")
99
bazel_dep(name = "bazel_skylib", version = "1.7.1")
1010
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0")
@@ -18,7 +18,7 @@ bazel_dep(name = "protobuf", version = "21.7", dev_dependency = True, repo_name
1818
bazel_dep(name = "rules_cc", version = "0.0.9", dev_dependency = True)
1919

2020
bazel_dep(name = "rules_dotnet", version = "0.15.1")
21-
bazel_dep(name = "rules_java", version = "7.6.3")
21+
bazel_dep(name = "rules_java", version = "7.11.1")
2222
bazel_dep(name = "rules_jvm_external", version = "6.3")
2323
bazel_dep(name = "rules_nodejs", version = "6.2.0")
2424
bazel_dep(name = "rules_oci", version = "1.7.6")

dotnet/src/webdriver/BiDi/WebDriver.Extensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace OpenQA.Selenium.BiDi;
55

66
public static class WebDriverExtensions
77
{
8-
public static async Task<BiDi> AsBidirectionalAsync(this IWebDriver webDriver)
8+
public static async Task<BiDi> AsBiDiAsync(this IWebDriver webDriver)
99
{
1010
var webSocketUrl = ((IHasCapabilities)webDriver).Capabilities.GetCapability("webSocketUrl");
1111

@@ -16,9 +16,9 @@ public static async Task<BiDi> AsBidirectionalAsync(this IWebDriver webDriver)
1616
return bidi;
1717
}
1818

19-
public static async Task<BrowsingContext> AsBidirectionalContextAsync(this IWebDriver webDriver)
19+
public static async Task<BrowsingContext> AsBiDiContextAsync(this IWebDriver webDriver)
2020
{
21-
var bidi = await webDriver.AsBidirectionalAsync();
21+
var bidi = await webDriver.AsBiDiAsync();
2222

2323
var currentBrowsingContext = new BrowsingContext(bidi, webDriver.CurrentWindowHandle);
2424

java/test/org/openqa/selenium/environment/webserver/CookieHandler.java

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ private Collection<Cookie> getCookies(HttpRequest request) {
116116
private void addCookie(HttpResponse response, Cookie cook) {
117117
StringBuilder cookie = new StringBuilder();
118118

119-
// TODO: escape string as necessary
120-
String name = cook.getName();
121-
cookie.append(name).append("=").append(cook.getValue()).append("; ");
119+
String name = escapeCookieValue(cook.getName());
120+
String value = escapeCookieValue(cook.getValue());
121+
cookie.append(name).append("=").append(value).append("; ");
122122

123123
append(cookie, cook.getDomain(), str -> "Domain=" + str);
124124
append(cookie, cook.getPath(), str -> "Path=" + str);
@@ -191,4 +191,45 @@ private Cookie parse(String cookieString) {
191191

192192
return builder.build();
193193
}
194+
195+
private String escapeCookieValue(String value) {
196+
if (value == null || value.isEmpty()) {
197+
return "";
198+
}
199+
200+
StringBuilder cookieValue = new StringBuilder();
201+
202+
for (char c : value.toCharArray()) {
203+
switch (c) {
204+
case '\\':
205+
cookieValue.append("\\\\");
206+
break;
207+
case '"':
208+
cookieValue.append("\\\"");
209+
break;
210+
case ';':
211+
cookieValue.append("\\;");
212+
break;
213+
case ',':
214+
cookieValue.append("\\,");
215+
break;
216+
case '\r':
217+
case '\n':
218+
// Skip carriage return and newline characters
219+
break;
220+
case '<':
221+
cookieValue.append("&lt;");
222+
break;
223+
case '>':
224+
cookieValue.append("&gt;");
225+
break;
226+
case '&':
227+
cookieValue.append("&amp;");
228+
break;
229+
default:
230+
cookieValue.append(c); // Append safe characters as they are
231+
}
232+
}
233+
return cookieValue.toString();
234+
}
194235
}

javascript/node/selenium-webdriver/CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## 4.24.1
22

3-
- Close CDP websocket connection on driver.quit (#14501)
3+
- Close CDP websocket connection on driver.quit (#14501)
44

55
## 4.24.0
66

javascript/node/selenium-webdriver/test/bidi/network_test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ suite(
4242
it('can listen to event before request is sent', async function () {
4343
let beforeRequestEvent = null
4444
await network.beforeRequestSent(function (event) {
45-
beforeRequestEvent = event
45+
if (event.request.url.includes('empty')) {
46+
beforeRequestEvent = event
47+
}
4648
})
4749

4850
await driver.get(Pages.emptyPage)

rb/lib/selenium/webdriver/chrome/service.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 9515
2525
EXECUTABLE = 'chromedriver'
2626
SHUTDOWN_SUPPORTED = true
27+
DRIVER_PATH_ENV_KEY = 'SE_CHROMEDRIVER'
2728

2829
def log
2930
return @log unless @log.is_a? String

rb/lib/selenium/webdriver/common/service.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def driver_path=(path)
6969
def initialize(path: nil, port: nil, log: nil, args: nil)
7070
port ||= self.class::DEFAULT_PORT
7171
args ||= []
72+
path ||= env_path
7273

7374
@executable_path = path
7475
@host = Platform.localhost
@@ -87,16 +88,22 @@ def initialize(path: nil, port: nil, log: nil, args: nil)
8788
end
8889

8990
def launch
90-
@executable_path ||= begin
91-
default_options = WebDriver.const_get("#{self.class.name&.split('::')&.[](2)}::Options").new
92-
DriverFinder.new(default_options, self).driver_path
93-
end
91+
@executable_path ||= env_path || find_driver_path
9492
ServiceManager.new(self).tap(&:start)
9593
end
9694

9795
def shutdown_supported
9896
self.class::SHUTDOWN_SUPPORTED
9997
end
98+
99+
def find_driver_path
100+
default_options = WebDriver.const_get("#{self.class.name&.split('::')&.[](2)}::Options").new
101+
DriverFinder.new(default_options, self).driver_path
102+
end
103+
104+
def env_path
105+
ENV.fetch(self.class::DRIVER_PATH_ENV_KEY, nil)
106+
end
100107
end # Service
101108
end # WebDriver
102109
end # Selenium

rb/lib/selenium/webdriver/edge/service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 9515
2525
EXECUTABLE = 'msedgedriver'
2626
SHUTDOWN_SUPPORTED = true
27-
27+
DRIVER_PATH_ENV_KEY = 'SE_EDGEDRIVER'
2828
def log
2929
return @log unless @log.is_a? String
3030

rb/lib/selenium/webdriver/firefox/service.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 4444
2525
EXECUTABLE = 'geckodriver'
2626
SHUTDOWN_SUPPORTED = false
27+
DRIVER_PATH_ENV_KEY = 'SE_GECKODRIVER'
2728
end # Service
2829
end # Firefox
2930
end # WebDriver

0 commit comments

Comments
 (0)