Skip to content

Commit 759e0d3

Browse files
authored
Merge branch 'trunk' into selenium_manager
2 parents 6d6381a + 28e9a3a commit 759e0d3

File tree

133 files changed

+6531
-7050
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+6531
-7050
lines changed

Rakefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,7 @@ namespace :py do
585585
nightly = ".#{Time.now.strftime('%Y%m%d%H%M')}"
586586
new_version = updated_version(old_version, arguments[:version], nightly)
587587

588-
['py/setup.py',
589-
'py/pyproject.toml',
588+
['py/pyproject.toml',
590589
'py/BUILD.bazel',
591590
'py/selenium/__init__.py',
592591
'py/selenium/webdriver/__init__.py',
@@ -1048,7 +1047,6 @@ namespace :all do
10481047
'py/selenium/webdriver/__init__.py',
10491048
'py/selenium/__init__.py',
10501049
'py/BUILD.bazel',
1051-
'py/setup.py',
10521050
'rb/lib/selenium/webdriver/version.rb',
10531051
'rb/Gemfile.lock'])
10541052

@@ -1110,7 +1108,6 @@ namespace :all do
11101108
'py/selenium/webdriver/__init__.py',
11111109
'py/BUILD.bazel',
11121110
'py/CHANGES',
1113-
'py/setup.py',
11141111
'rb/lib/selenium/webdriver/version.rb',
11151112
'rb/CHANGES',
11161113
'rb/Gemfile.lock',

WORKSPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ rules_closure_toolchains()
3434

3535
http_archive(
3636
name = "rules_rust",
37-
integrity = "sha256-Zx3bP+Xrz53TTQUeynNS+68z+lO/Ye7Qt1pMNIKeVIA=",
38-
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.52.2/rules_rust-v0.52.2.tar.gz"],
37+
integrity = "sha256-eEXiHXSGUH6qD1bdI5KXZ/B04m0wIUeoyM7pmujzbbQ=",
38+
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.55.5/rules_rust-0.55.5.tar.gz"],
3939
)
4040

4141
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")

common/repositories.bzl

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def pin_browsers():
1111

1212
http_archive(
1313
name = "linux_firefox",
14-
url = "https://ftp.mozilla.org/pub/firefox/releases/132.0.2/linux-x86_64/en-US/firefox-132.0.2.tar.bz2",
15-
sha256 = "777d47f8b8710ab450582dc0dc0cdf8f43c2291249b3eaf740ee28ee34cda139",
14+
url = "https://ftp.mozilla.org/pub/firefox/releases/133.0/linux-x86_64/en-US/firefox-133.0.tar.bz2",
15+
sha256 = "63cb097174d429043ad128341358d14cdb5d4c9d05d035d9e3094634ceaf22c2",
1616
build_file_content = """
1717
load("@aspect_rules_js//js:defs.bzl", "js_library")
1818
package(default_visibility = ["//visibility:public"])
@@ -33,8 +33,8 @@ js_library(
3333

3434
dmg_archive(
3535
name = "mac_firefox",
36-
url = "https://ftp.mozilla.org/pub/firefox/releases/132.0.2/mac/en-US/Firefox%20132.0.2.dmg",
37-
sha256 = "233251c46eb4964868d815a9233cab855ac6160736310771a67af93a9b78224d",
36+
url = "https://ftp.mozilla.org/pub/firefox/releases/133.0/mac/en-US/Firefox%20133.0.dmg",
37+
sha256 = "02c76e21d64f21d4e45b1205717ccd0736a75f2a50b01c74b25b17e374447a76",
3838
build_file_content = """
3939
load("@aspect_rules_js//js:defs.bzl", "js_library")
4040
package(default_visibility = ["//visibility:public"])
@@ -50,8 +50,8 @@ js_library(
5050

5151
http_archive(
5252
name = "linux_beta_firefox",
53-
url = "https://ftp.mozilla.org/pub/firefox/releases/133.0b9/linux-x86_64/en-US/firefox-133.0b9.tar.bz2",
54-
sha256 = "5c9f79912bfbf892d2b676973a26ffc078ee9b8fd9b791bfa856db030e657750",
53+
url = "https://ftp.mozilla.org/pub/firefox/releases/134.0b5/linux-x86_64/en-US/firefox-134.0b5.tar.bz2",
54+
sha256 = "9688f50d2bba71c7781e7f46100e97223d469d37197cf99511a2b2e27efd50a2",
5555
build_file_content = """
5656
load("@aspect_rules_js//js:defs.bzl", "js_library")
5757
package(default_visibility = ["//visibility:public"])
@@ -72,8 +72,8 @@ js_library(
7272

7373
dmg_archive(
7474
name = "mac_beta_firefox",
75-
url = "https://ftp.mozilla.org/pub/firefox/releases/133.0b9/mac/en-US/Firefox%20133.0b9.dmg",
76-
sha256 = "0eb0fabe9216dc80c2ca403dd2eba935d71f2bdc1dea1d1cc37f03666ef094d1",
75+
url = "https://ftp.mozilla.org/pub/firefox/releases/134.0b5/mac/en-US/Firefox%20134.0b5.dmg",
76+
sha256 = "5c6d02d149637e963c55c741ebed98a8dacfa93c90e99065981bbdd9d511a0f1",
7777
build_file_content = """
7878
load("@aspect_rules_js//js:defs.bzl", "js_library")
7979
package(default_visibility = ["//visibility:public"])
@@ -123,10 +123,10 @@ js_library(
123123

124124
pkg_archive(
125125
name = "mac_edge",
126-
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/08b226c9-fbe8-43c0-94fe-ed9c3eeb8f59/MicrosoftEdge-131.0.2903.51.pkg",
127-
sha256 = "5bc1eab86bb315aa9f2cd2b7d9afe072df35280f6e6d1a9ca9c108d95bda8acd",
126+
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/a310bc51-4dc2-4780-9677-41f3ecf37e31/MicrosoftEdge-131.0.2903.86.pkg",
127+
sha256 = "77dc0bf6d465815d3414a1b52d506323619c9debb12f9feb85ec4ad2c7e58585",
128128
move = {
129-
"MicrosoftEdge-131.0.2903.51.pkg/Payload/Microsoft Edge.app": "Edge.app",
129+
"MicrosoftEdge-131.0.2903.86.pkg/Payload/Microsoft Edge.app": "Edge.app",
130130
},
131131
build_file_content = """
132132
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -143,8 +143,8 @@ js_library(
143143

144144
deb_archive(
145145
name = "linux_edge",
146-
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_131.0.2903.51-1_amd64.deb",
147-
sha256 = "8aad12c97bcae417ff9cc4251b75211eeda7f1513312dc57b2f744e824e028c0",
146+
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_131.0.2903.86-1_amd64.deb",
147+
sha256 = "4c7844e51ffefbf5a595f3d93e633481c6081f0fd954d15cc08066ea23ddacf3",
148148
build_file_content = """
149149
load("@aspect_rules_js//js:defs.bzl", "js_library")
150150
package(default_visibility = ["//visibility:public"])
@@ -165,8 +165,8 @@ js_library(
165165

166166
http_archive(
167167
name = "linux_edgedriver",
168-
url = "https://msedgedriver.azureedge.net/131.0.2903.52/edgedriver_linux64.zip",
169-
sha256 = "ddbeda7cec5ed16b96c3cf0f6759de30e4f3726da9da31bfba1371ccd8fcfd14",
168+
url = "https://msedgedriver.azureedge.net/131.0.2903.84/edgedriver_linux64.zip",
169+
sha256 = "13b8024056a2ae72dfc45907213212756ffaf52567fa2b367acadd20badfb4bb",
170170
build_file_content = """
171171
load("@aspect_rules_js//js:defs.bzl", "js_library")
172172
package(default_visibility = ["//visibility:public"])
@@ -182,8 +182,8 @@ js_library(
182182

183183
http_archive(
184184
name = "mac_edgedriver",
185-
url = "https://msedgedriver.azureedge.net/131.0.2903.56/edgedriver_mac64.zip",
186-
sha256 = "4f4d1d5b45849677f8d8e706f7b5ca9ebb99f40ed3b4ee203c2535a3429e0d5b",
185+
url = "https://msedgedriver.azureedge.net/131.0.2903.84/edgedriver_mac64.zip",
186+
sha256 = "288c7b38d24a0650ca60e9e2a231c0c71976adc37be9e11e777e0596c40b3878",
187187
build_file_content = """
188188
load("@aspect_rules_js//js:defs.bzl", "js_library")
189189
package(default_visibility = ["//visibility:public"])
@@ -199,8 +199,8 @@ js_library(
199199

200200
http_archive(
201201
name = "linux_chrome",
202-
url = "https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.85/linux64/chrome-linux64.zip",
203-
sha256 = "3a6d928b0002ec012a53b6bb65dcaf95add008adc223c961d566d824982a767e",
202+
url = "https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.87/linux64/chrome-linux64.zip",
203+
sha256 = "5ed0d25537b964cdf826224165a80d125ae67bbb980065c2f1e665dae6686904",
204204
build_file_content = """
205205
load("@aspect_rules_js//js:defs.bzl", "js_library")
206206
package(default_visibility = ["//visibility:public"])
@@ -221,8 +221,8 @@ js_library(
221221

222222
http_archive(
223223
name = "mac_chrome",
224-
url = "https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.85/mac-x64/chrome-mac-x64.zip",
225-
sha256 = "e26a606e2a3da403c6e1e93617a7b51ee010706614eb88de5b16470276e0896b",
224+
url = "https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.87/mac-x64/chrome-mac-x64.zip",
225+
sha256 = "a9ab895b3ab102973f224f35bef6f0336b690f03cc5fbb73110bf448fe30ce70",
226226
strip_prefix = "chrome-mac-x64",
227227
patch_cmds = [
228228
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -243,8 +243,8 @@ js_library(
243243

244244
http_archive(
245245
name = "linux_chromedriver",
246-
url = "https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.85/linux64/chromedriver-linux64.zip",
247-
sha256 = "33910b16568feabd2b50a26a2c4456d154c760d6e28347427f99c025661a4f3e",
246+
url = "https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.87/linux64/chromedriver-linux64.zip",
247+
sha256 = "bb0c5ee6594453258b328b838adc194ed0df000f2a6e5ead306b637a995e387b",
248248
strip_prefix = "chromedriver-linux64",
249249
build_file_content = """
250250
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -261,8 +261,8 @@ js_library(
261261

262262
http_archive(
263263
name = "mac_chromedriver",
264-
url = "https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.85/mac-x64/chromedriver-mac-x64.zip",
265-
sha256 = "ee194eba1d52dea61dfbf08b05a2ce139660e9c7d20d15024c3a0757ac4a5fcb",
264+
url = "https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.87/mac-x64/chromedriver-mac-x64.zip",
265+
sha256 = "9fa91a7b7e969cbd6edb089e14b8db2189353519640dcc84c067369918bfb04f",
266266
strip_prefix = "chromedriver-mac-x64",
267267
build_file_content = """
268268
load("@aspect_rules_js//js:defs.bzl", "js_library")

dotnet/src/webdriver/CookieJar.cs

Lines changed: 58 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -21,128 +21,125 @@
2121
using System.Collections.Generic;
2222
using System.Collections.ObjectModel;
2323

24+
#nullable enable
25+
2426
namespace OpenQA.Selenium
2527
{
26-
/// <summary>
27-
/// Defines an interface allowing the user to manipulate cookies on the current page.
28-
/// </summary>
29-
internal class CookieJar : ICookieJar
28+
internal sealed class CookieJar(WebDriver driver) : ICookieJar
3029
{
31-
private WebDriver driver;
32-
33-
/// <summary>
34-
/// Initializes a new instance of the <see cref="CookieJar"/> class.
35-
/// </summary>
36-
/// <param name="driver">The driver that is currently in use</param>
37-
public CookieJar(WebDriver driver)
38-
{
39-
this.driver = driver;
40-
}
41-
4230
/// <summary>
4331
/// Gets all cookies defined for the current page.
4432
/// </summary>
4533
public ReadOnlyCollection<Cookie> AllCookies
4634
{
47-
get { return this.GetAllCookies(); }
35+
get
36+
{
37+
Response response = driver.InternalExecute(DriverCommand.GetAllCookies, new Dictionary<string, object>());
38+
39+
try
40+
{
41+
List<Cookie> toReturn = new List<Cookie>();
42+
if (response.Value is object?[] cookies)
43+
{
44+
foreach (object? rawCookie in cookies)
45+
{
46+
if (rawCookie != null)
47+
{
48+
Cookie newCookie = Cookie.FromDictionary((Dictionary<string, object?>)rawCookie);
49+
toReturn.Add(newCookie);
50+
}
51+
}
52+
}
53+
54+
return new ReadOnlyCollection<Cookie>(toReturn);
55+
}
56+
catch (Exception e)
57+
{
58+
throw new WebDriverException("Unexpected problem getting cookies", e);
59+
}
60+
}
4861
}
4962

5063
/// <summary>
5164
/// Method for creating a cookie in the browser
5265
/// </summary>
5366
/// <param name="cookie"><see cref="Cookie"/> that represents a cookie in the browser</param>
67+
/// <exception cref="ArgumentNullException">If <paramref name="cookie"/> is <see langword="null"/>.</exception>
5468
public void AddCookie(Cookie cookie)
5569
{
70+
if (cookie is null)
71+
{
72+
throw new ArgumentNullException(nameof(cookie));
73+
}
74+
5675
Dictionary<string, object> parameters = new Dictionary<string, object>();
5776
parameters.Add("cookie", cookie);
58-
this.driver.InternalExecute(DriverCommand.AddCookie, parameters);
77+
driver.InternalExecute(DriverCommand.AddCookie, parameters);
5978
}
6079

6180
/// <summary>
6281
/// Delete the cookie by passing in the name of the cookie
6382
/// </summary>
6483
/// <param name="name">The name of the cookie that is in the browser</param>
84+
/// <exception cref="ArgumentNullException">If <paramref name="name"/> is <see langword="null"/>.</exception>
6585
public void DeleteCookieNamed(string name)
6686
{
87+
if (name is null)
88+
{
89+
throw new ArgumentNullException(nameof(name));
90+
}
91+
6792
Dictionary<string, object> parameters = new Dictionary<string, object>();
6893
parameters.Add("name", name);
69-
this.driver.InternalExecute(DriverCommand.DeleteCookie, parameters);
94+
driver.InternalExecute(DriverCommand.DeleteCookie, parameters);
7095
}
7196

7297
/// <summary>
7398
/// Delete a cookie in the browser by passing in a copy of a cookie
7499
/// </summary>
75100
/// <param name="cookie">An object that represents a copy of the cookie that needs to be deleted</param>
101+
/// <exception cref="ArgumentNullException">If <paramref name="cookie"/> is <see langword="null"/>.</exception>
76102
public void DeleteCookie(Cookie cookie)
77103
{
78-
if (cookie != null)
104+
if (cookie is null)
79105
{
80-
this.DeleteCookieNamed(cookie.Name);
106+
throw new ArgumentNullException(nameof(cookie));
81107
}
108+
109+
this.DeleteCookieNamed(cookie.Name);
82110
}
83111

84112
/// <summary>
85113
/// Delete All Cookies that are present in the browser
86114
/// </summary>
87115
public void DeleteAllCookies()
88116
{
89-
this.driver.InternalExecute(DriverCommand.DeleteAllCookies, null);
117+
driver.InternalExecute(DriverCommand.DeleteAllCookies, null);
90118
}
91119

92120
/// <summary>
93121
/// Method for returning a getting a cookie by name
94122
/// </summary>
95123
/// <param name="name">name of the cookie that needs to be returned</param>
96-
/// <returns>A Cookie from the name</returns>
97-
public Cookie GetCookieNamed(string name)
124+
/// <returns>A Cookie from the name; or <see langword="null"/> if not found.</returns>
125+
public Cookie? GetCookieNamed(string name)
98126
{
99-
Cookie cookieToReturn = null;
100-
if (name != null)
127+
if (name is null)
101128
{
102-
ReadOnlyCollection<Cookie> allCookies = this.AllCookies;
103-
foreach (Cookie currentCookie in allCookies)
104-
{
105-
if (name.Equals(currentCookie.Name))
106-
{
107-
cookieToReturn = currentCookie;
108-
break;
109-
}
110-
}
129+
throw new ArgumentNullException(nameof(name));
111130
}
112131

113-
return cookieToReturn;
114-
}
115132

116-
/// <summary>
117-
/// Method for getting a Collection of Cookies that are present in the browser
118-
/// </summary>
119-
/// <returns>ReadOnlyCollection of Cookies in the browser</returns>
120-
private ReadOnlyCollection<Cookie> GetAllCookies()
121-
{
122-
List<Cookie> toReturn = new List<Cookie>();
123-
object returned = this.driver.InternalExecute(DriverCommand.GetAllCookies, new Dictionary<string, object>()).Value;
124-
125-
try
133+
foreach (Cookie currentCookie in this.AllCookies)
126134
{
127-
object[] cookies = returned as object[];
128-
if (cookies != null)
135+
if (name.Equals(currentCookie.Name))
129136
{
130-
foreach (object rawCookie in cookies)
131-
{
132-
Dictionary<string, object> cookieDictionary = rawCookie as Dictionary<string, object>;
133-
if (rawCookie != null)
134-
{
135-
toReturn.Add(Cookie.FromDictionary(cookieDictionary));
136-
}
137-
}
137+
return currentCookie;
138138
}
139139

140-
return new ReadOnlyCollection<Cookie>(toReturn);
141-
}
142-
catch (Exception e)
143-
{
144-
throw new WebDriverException("Unexpected problem getting cookies", e);
145140
}
141+
142+
return null;
146143
}
147144
}
148145
}

0 commit comments

Comments
 (0)