Skip to content

Commit d685665

Browse files
committed
[dotnet][cdp] add support Chrome 102 and remove for Chrome 99
1 parent 3b0eef2 commit d685665

17 files changed

+198
-196
lines changed

‎dotnet/selenium-dotnet-version.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ SUPPORTED_NET_STANDARD_VERSIONS = ["netstandard2.0", "netstandard2.1", "net5.0"]
77

88
SUPPORTED_DEVTOOLS_VERSIONS = [
99
"v85",
10-
"v99",
1110
"v100",
1211
"v101",
12+
"v102",
1313
]
1414

1515
ASSEMBLY_COMPANY = "Selenium Committers"

‎dotnet/src/webdriver/DevTools/DevToolsDomains.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public abstract class DevToolsDomains
3737
// added to this dictionary.
3838
private static readonly Dictionary<int, Type> SupportedDevToolsVersions = new Dictionary<int, Type>()
3939
{
40+
{ 102, typeof(V102.V102Domains) },
4041
{ 101, typeof(V101.V101Domains) },
4142
{ 100, typeof(V100.V100Domains) },
42-
{ 99, typeof(V99.V99Domains) },
4343
{ 85, typeof(V85.V85Domains) }
4444
};
4545

‎dotnet/src/webdriver/DevTools/v99/V99Domains.cs renamed to ‎dotnet/src/webdriver/DevTools/v102/V102Domains.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="V99Domains.cs" company="WebDriver Committers">
1+
// <copyright file="V102Domains.cs" company="WebDriver Committers">
22
// Licensed to the Software Freedom Conservancy (SFC) under one
33
// or more contributor license agreements. See the NOTICE file
44
// distributed with this work for additional information
@@ -19,24 +19,24 @@
1919
using System.Collections.Generic;
2020
using System.Text;
2121

22-
namespace OpenQA.Selenium.DevTools.V99
22+
namespace OpenQA.Selenium.DevTools.V102
2323
{
2424
/// <summary>
25-
/// Class containing the domain implementation for version 99 of the DevTools Protocol.
25+
/// Class containing the domain implementation for version 102 of the DevTools Protocol.
2626
/// </summary>
27-
public class V99Domains : DevToolsDomains
27+
public class V102Domains : DevToolsDomains
2828
{
2929
private DevToolsSessionDomains domains;
3030

31-
public V99Domains(DevToolsSession session)
31+
public V102Domains(DevToolsSession session)
3232
{
3333
this.domains = new DevToolsSessionDomains(session);
3434
}
3535

3636
/// <summary>
3737
/// Gets the DevTools Protocol version for which this class is valid.
3838
/// </summary>
39-
public static int DevToolsVersion => 99;
39+
public static int DevToolsVersion => 102;
4040

4141
/// <summary>
4242
/// Gets the version-specific domains for the DevTools session. This value must be cast to a version specific type to be at all useful.
@@ -46,21 +46,21 @@ public V99Domains(DevToolsSession session)
4646
/// <summary>
4747
/// Gets the object used for manipulating network information in the browser.
4848
/// </summary>
49-
public override DevTools.Network Network => new V99Network(domains.Network, domains.Fetch);
49+
public override DevTools.Network Network => new V102Network(domains.Network, domains.Fetch);
5050

5151
/// <summary>
5252
/// Gets the object used for manipulating the browser's JavaScript execution.
5353
/// </summary>
54-
public override JavaScript JavaScript => new V99JavaScript(domains.Runtime, domains.Page);
54+
public override JavaScript JavaScript => new V102JavaScript(domains.Runtime, domains.Page);
5555

5656
/// <summary>
5757
/// Gets the object used for manipulating DevTools Protocol targets.
5858
/// </summary>
59-
public override DevTools.Target Target => new V99Target(domains.Target);
59+
public override DevTools.Target Target => new V102Target(domains.Target);
6060

6161
/// <summary>
6262
/// Gets the object used for manipulating the browser's logs.
6363
/// </summary>
64-
public override DevTools.Log Log => new V99Log(domains.Log);
64+
public override DevTools.Log Log => new V102Log(domains.Log);
6565
}
6666
}

‎dotnet/src/webdriver/DevTools/v99/V99JavaScript.cs renamed to ‎dotnet/src/webdriver/DevTools/v102/V102JavaScript.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="V99JavaScript.cs" company="WebDriver Committers">
1+
// <copyright file="V102JavaScript.cs" company="WebDriver Committers">
22
// Licensed to the Software Freedom Conservancy (SFC) under one
33
// or more contributor license agreements. See the NOTICE file
44
// distributed with this work for additional information
@@ -18,25 +18,25 @@
1818
using System;
1919
using System.Collections.Generic;
2020
using System.Threading.Tasks;
21-
using OpenQA.Selenium.DevTools.V99.Page;
22-
using OpenQA.Selenium.DevTools.V99.Runtime;
21+
using OpenQA.Selenium.DevTools.V102.Page;
22+
using OpenQA.Selenium.DevTools.V102.Runtime;
2323

24-
namespace OpenQA.Selenium.DevTools.V99
24+
namespace OpenQA.Selenium.DevTools.V102
2525
{
2626
/// <summary>
27-
/// Class containing the JavaScript implementation for version 99 of the DevTools Protocol.
27+
/// Class containing the JavaScript implementation for version 102 of the DevTools Protocol.
2828
/// </summary>
29-
public class V99JavaScript : JavaScript
29+
public class V102JavaScript : JavaScript
3030
{
3131
private RuntimeAdapter runtime;
3232
private PageAdapter page;
3333

3434
/// <summary>
35-
/// Initializes a new instance of the <see cref="V99JavaScript"/> class.
35+
/// Initializes a new instance of the <see cref="V102JavaScript"/> class.
3636
/// </summary>
3737
/// <param name="runtime">The DevTools Protocol adapter for the Runtime domain.</param>
3838
/// <param name="page">The DevTools Protocol adapter for the Page domain.</param>
39-
public V99JavaScript(RuntimeAdapter runtime, PageAdapter page)
39+
public V102JavaScript(RuntimeAdapter runtime, PageAdapter page)
4040
{
4141
this.runtime = runtime;
4242
this.page = page;

‎dotnet/src/webdriver/DevTools/v99/V99Log.cs renamed to ‎dotnet/src/webdriver/DevTools/v102/V102Log.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="V99Log.cs" company="WebDriver Committers">
1+
// <copyright file="V102Log.cs" company="WebDriver Committers">
22
// Licensed to the Software Freedom Conservancy (SFC) under one
33
// or more contributor license agreements. See the NOTICE file
44
// distributed with this work for additional information
@@ -20,22 +20,22 @@
2020
using System.Text;
2121
using System.Threading;
2222
using System.Threading.Tasks;
23-
using OpenQA.Selenium.DevTools.V99.Log;
23+
using OpenQA.Selenium.DevTools.V102.Log;
2424

25-
namespace OpenQA.Selenium.DevTools.V99
25+
namespace OpenQA.Selenium.DevTools.V102
2626
{
2727
/// <summary>
28-
/// Class containing the browser's log as referenced by version 99 of the DevTools Protocol.
28+
/// Class containing the browser's log as referenced by version 102 of the DevTools Protocol.
2929
/// </summary>
30-
public class V99Log : DevTools.Log
30+
public class V102Log : DevTools.Log
3131
{
3232
private LogAdapter adapter;
3333

3434
/// <summary>
35-
/// Initializes a new instance of the <see cref="V99Log"/> class.
35+
/// Initializes a new instance of the <see cref="V102Log"/> class.
3636
/// </summary>
3737
/// <param name="adapter">The adapter for the Log domain.</param>
38-
public V99Log(LogAdapter adapter)
38+
public V102Log(LogAdapter adapter)
3939
{
4040
this.adapter = adapter;
4141
this.adapter.EntryAdded += OnAdapterEntryAdded;

‎dotnet/src/webdriver/DevTools/v99/V99Network.cs renamed to ‎dotnet/src/webdriver/DevTools/v102/V102Network.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="V99Network.cs" company="WebDriver Committers">
1+
// <copyright file="V102Network.cs" company="WebDriver Committers">
22
// Licensed to the Software Freedom Conservancy (SFC) under one
33
// or more contributor license agreements. See the NOTICE file
44
// distributed with this work for additional information
@@ -20,25 +20,25 @@
2020
using System.Collections.Generic;
2121
using System.Text;
2222
using System.Threading.Tasks;
23-
using OpenQA.Selenium.DevTools.V99.Fetch;
24-
using OpenQA.Selenium.DevTools.V99.Network;
23+
using OpenQA.Selenium.DevTools.V102.Fetch;
24+
using OpenQA.Selenium.DevTools.V102.Network;
2525

26-
namespace OpenQA.Selenium.DevTools.V99
26+
namespace OpenQA.Selenium.DevTools.V102
2727
{
2828
/// <summary>
29-
/// Class providing functionality for manipulating network calls using version 99 of the DevTools Protocol
29+
/// Class providing functionality for manipulating network calls using version 102 of the DevTools Protocol
3030
/// </summary>
31-
public class V99Network : DevTools.Network
31+
public class V102Network : DevTools.Network
3232
{
3333
private FetchAdapter fetch;
3434
private NetworkAdapter network;
3535

3636
/// <summary>
37-
/// Initializes a new instance of the <see cref="V99Network"/> class.
37+
/// Initializes a new instance of the <see cref="V102Network"/> class.
3838
/// </summary>
3939
/// <param name="network">The adapter for the Network domain.</param>
4040
/// <param name="fetch">The adapter for the Fetch domain.</param>
41-
public V99Network(NetworkAdapter network, FetchAdapter fetch)
41+
public V102Network(NetworkAdapter network, FetchAdapter fetch)
4242
{
4343
this.network = network;
4444
this.fetch = fetch;
@@ -80,12 +80,12 @@ public override async Task DisableNetwork()
8080
/// <returns>A task that represents the asynchronous operation.</returns>
8181
public override async Task EnableFetchForAllPatterns()
8282
{
83-
await fetch.Enable(new OpenQA.Selenium.DevTools.V99.Fetch.EnableCommandSettings()
83+
await fetch.Enable(new OpenQA.Selenium.DevTools.V102.Fetch.EnableCommandSettings()
8484
{
85-
Patterns = new OpenQA.Selenium.DevTools.V99.Fetch.RequestPattern[]
85+
Patterns = new OpenQA.Selenium.DevTools.V102.Fetch.RequestPattern[]
8686
{
87-
new OpenQA.Selenium.DevTools.V99.Fetch.RequestPattern() { UrlPattern = "*", RequestStage = RequestStage.Request },
88-
new OpenQA.Selenium.DevTools.V99.Fetch.RequestPattern() { UrlPattern = "*", RequestStage = RequestStage.Response }
87+
new OpenQA.Selenium.DevTools.V102.Fetch.RequestPattern() { UrlPattern = "*", RequestStage = RequestStage.Request },
88+
new OpenQA.Selenium.DevTools.V102.Fetch.RequestPattern() { UrlPattern = "*", RequestStage = RequestStage.Response }
8989
},
9090
HandleAuthRequests = true
9191
});
@@ -208,9 +208,9 @@ public override async Task ContinueWithAuth(string requestId, string userName, s
208208
await fetch.ContinueWithAuth(new ContinueWithAuthCommandSettings()
209209
{
210210
RequestId = requestId,
211-
AuthChallengeResponse = new V99.Fetch.AuthChallengeResponse()
211+
AuthChallengeResponse = new V102.Fetch.AuthChallengeResponse()
212212
{
213-
Response = V99.Fetch.AuthChallengeResponseResponseValues.ProvideCredentials,
213+
Response = V102.Fetch.AuthChallengeResponseResponseValues.ProvideCredentials,
214214
Username = userName,
215215
Password = password
216216
}
@@ -227,9 +227,9 @@ public override async Task CancelAuth(string requestId)
227227
await fetch.ContinueWithAuth(new ContinueWithAuthCommandSettings()
228228
{
229229
RequestId = requestId,
230-
AuthChallengeResponse = new OpenQA.Selenium.DevTools.V99.Fetch.AuthChallengeResponse()
230+
AuthChallengeResponse = new OpenQA.Selenium.DevTools.V102.Fetch.AuthChallengeResponse()
231231
{
232-
Response = V99.Fetch.AuthChallengeResponseResponseValues.CancelAuth
232+
Response = V102.Fetch.AuthChallengeResponseResponseValues.CancelAuth
233233
}
234234
});
235235
}

‎dotnet/src/webdriver/DevTools/v99/V99Target.cs renamed to ‎dotnet/src/webdriver/DevTools/v102/V102Target.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="V99Target.cs" company="WebDriver Committers">
1+
// <copyright file="V102Target.cs" company="WebDriver Committers">
22
// Licensed to the Software Freedom Conservancy (SFC) under one
33
// or more contributor license agreements. See the NOTICE file
44
// distributed with this work for additional information
@@ -21,22 +21,22 @@
2121
using System.Collections.ObjectModel;
2222
using System.Text;
2323
using System.Threading.Tasks;
24-
using OpenQA.Selenium.DevTools.V99.Target;
24+
using OpenQA.Selenium.DevTools.V102.Target;
2525

26-
namespace OpenQA.Selenium.DevTools.V99
26+
namespace OpenQA.Selenium.DevTools.V102
2727
{
2828
/// <summary>
29-
/// Class providing functionality for manipulating targets for version 99 of the DevTools Protocol
29+
/// Class providing functionality for manipulating targets for version 102 of the DevTools Protocol
3030
/// </summary>
31-
public class V99Target : DevTools.Target
31+
public class V102Target : DevTools.Target
3232
{
3333
private TargetAdapter adapter;
3434

3535
/// <summary>
36-
/// Initializes a new instance of the <see cref="V99Target"/> class.
36+
/// Initializes a new instance of the <see cref="V102Target"/> class.
3737
/// </summary>
3838
/// <param name="adapter">The adapter for the Target domain.</param>
39-
public V99Target(TargetAdapter adapter)
39+
public V102Target(TargetAdapter adapter)
4040
{
4141
this.adapter = adapter;
4242
adapter.DetachedFromTarget += OnDetachedFromTarget;

‎dotnet/src/webdriver/WebDriver.csproj.prebuild.cmd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v85\DevToolsSession
2727
popd
2828
)
2929

30-
if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v99\DevToolsSessionDomains.cs" (
31-
echo Generating CDP code for version 99
32-
pushd "%1..\..\.."
33-
bazel build //dotnet/src/webdriver/cdp:generate-v99
34-
popd
35-
)
36-
3730
if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v100\DevToolsSessionDomains.cs" (
3831
echo Generating CDP code for version 100
3932
pushd "%1..\..\.."
@@ -47,3 +40,10 @@ if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v101\DevToolsSessio
4740
bazel build //dotnet/src/webdriver/cdp:generate-v101
4841
popd
4942
)
43+
44+
if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v102\DevToolsSessionDomains.cs" (
45+
echo Generating CDP code for version 102
46+
pushd "%1..\..\.."
47+
bazel build //dotnet/src/webdriver/cdp:generate-v102
48+
popd
49+
)

‎dotnet/src/webdriver/WebDriver.csproj.prebuild.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ then
2323
bazel build //dotnet/src/webdriver/cdp:generate-v85
2424
fi
2525

26-
if [[ ! -f "$1../../../bazel-bin/dotnet/src/webdriver/cdp/v99/DevToolsSessionDomains.cs" ]]
27-
then
28-
echo "Generating CDP code for version 99"
29-
bazel build //dotnet/src/webdriver/cdp:generate-v99
30-
fi
31-
3226
if [[ ! -f "$1../../../bazel-bin/dotnet/src/webdriver/cdp/v100/DevToolsSessionDomains.cs" ]]
3327
then
3428
echo "Generating CDP code for version 100"
@@ -40,3 +34,9 @@ then
4034
echo "Generating CDP code for version 101"
4135
bazel build //dotnet/src/webdriver/cdp:generate-v101
4236
fi
37+
38+
if [[ ! -f "$1../../../bazel-bin/dotnet/src/webdriver/cdp/v102/DevToolsSessionDomains.cs" ]]
39+
then
40+
echo "Generating CDP code for version 102"
41+
bazel build //dotnet/src/webdriver/cdp:generate-v102
42+
fi

‎dotnet/src/webdriver/cdp/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contents of the `//dotnet/src/webdriver/DevTools/v<N-1>` directory into it.
1010
3. Rename each of the `*.cs` files in `//dotnet/src/webdriver/DevTools/v<N>` so that
1111
the file names start with `V<N>` instead of `V<N-1>`.
1212
4. In each of the `*.cs` files in `//dotnet/src/webdriver/DevTools/v<N>`, update all
13-
occurances of `V<N-1>` to `V<N>`. **IMPORTANT:** Do _not_ change the case of `V<N>` in
13+
occurrences of `V<N-1>` to `V<N>`. **IMPORTANT:** Do _not_ change the case of `V<N>` in
1414
each `.cs` file.
1515
5. In [`//dotnet/src/webdriver/DevTools/DevToolsDomains.cs`](https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/DevTools/DevToolsDomains.cs),
1616
add an entry for version `<N>` to the `SupportedDevToolsVersions` dictionary initialization.
@@ -37,7 +37,9 @@ then
3737
fi
3838
```
3939

40-
8. Commit the changes.
40+
8. In each of the `*.cs` files in `//dotnet/test/common/DevTools/`, update all
41+
occurrences of `V<N-1>` to `V<N>`.
42+
9. Commit the changes.
4143

4244
### Removing support for a version of Chromium DevTools Protocol from the .NET bindings
4345

‎dotnet/test/common/DevTools/DevToolsConsoleTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ public class DevToolsConsoleTest : DevToolsTestFixture
1818
[IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")]
1919
public async Task VerifyMessageAdded()
2020
{
21-
var domains = session.GetVersionSpecificDomains<V101.DevToolsSessionDomains>();
21+
var domains = session.GetVersionSpecificDomains<V102.DevToolsSessionDomains>();
2222
string consoleMessage = "Hello Selenium";
2323

2424
ManualResetEventSlim sync = new ManualResetEventSlim(false);
25-
EventHandler<V101.Console.MessageAddedEventArgs> messageAddedHandler = (sender, e) =>
25+
EventHandler<V102.Console.MessageAddedEventArgs> messageAddedHandler = (sender, e) =>
2626
{
2727
Assert.That(e.Message.Text, Is.EqualTo(consoleMessage));
2828
sync.Set();

‎dotnet/test/common/DevTools/DevToolsLogTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ public class DevToolsLogTest : DevToolsTestFixture
1818
[IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")]
1919
public async Task VerifyEntryAddedAndClearLog()
2020
{
21-
var domains = session.GetVersionSpecificDomains<V101.DevToolsSessionDomains>();
21+
var domains = session.GetVersionSpecificDomains<V102.DevToolsSessionDomains>();
2222
ManualResetEventSlim sync = new ManualResetEventSlim(false);
23-
EventHandler<V101.Log.EntryAddedEventArgs> entryAddedHandler = (sender, e) =>
23+
EventHandler<V102.Log.EntryAddedEventArgs> entryAddedHandler = (sender, e) =>
2424
{
2525
Assert.That(e.Entry.Text.Contains("404"));
26-
Assert.That(e.Entry.Level == V101.Log.LogEntryLevelValues.Error);
26+
Assert.That(e.Entry.Level == V102.Log.LogEntryLevelValues.Error);
2727
sync.Set();
2828
};
2929

0 commit comments

Comments
 (0)