Skip to content

Commit

Permalink
[cdp] add support for CDP 116 and remove support for CDP 113
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Aug 16, 2023
1 parent 9a402a0 commit 811bf14
Show file tree
Hide file tree
Showing 31 changed files with 168 additions and 170 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ task '//java/test/org/openqa/selenium/environment/webserver:webserver:uber' => [
JAVA_RELEASE_TARGETS = %w[
//java/src/org/openqa/selenium/chrome:chrome.publish
//java/src/org/openqa/selenium/chromium:chromium.publish
//java/src/org/openqa/selenium/devtools/v113:v113.publish
//java/src/org/openqa/selenium/devtools/v114:v114.publish
//java/src/org/openqa/selenium/devtools/v115:v115.publish
//java/src/org/openqa/selenium/devtools/v116:v116.publish
//java/src/org/openqa/selenium/devtools/v85:v85.publish
//java/src/org/openqa/selenium/edge:edge.publish
//java/src/org/openqa/selenium/firefox:firefox.publish
Expand Down
2 changes: 1 addition & 1 deletion dotnet/selenium-dotnet-version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ SUPPORTED_NET_STANDARD_VERSIONS = ["netstandard2.0", "netstandard2.1", "net5.0",

SUPPORTED_DEVTOOLS_VERSIONS = [
"v85",
"v113",
"v114",
"v115",
"v116",
]

ASSEMBLY_COMPANY = "Selenium Committers"
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/DevTools/DevToolsDomains.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public abstract class DevToolsDomains
// added to this dictionary.
private static readonly Dictionary<int, Type> SupportedDevToolsVersions = new Dictionary<int, Type>()
{
{ 116, typeof(V116.V116Domains) },
{ 115, typeof(V115.V115Domains) },
{ 114, typeof(V114.V114Domains) },
{ 113, typeof(V113.V113Domains) },
{ 85, typeof(V85.V85Domains) }
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="V113Domains.cs" company="WebDriver Committers">
// <copyright file="V116Domains.cs" company="WebDriver Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
Expand All @@ -19,24 +19,24 @@
using System.Collections.Generic;
using System.Text;

namespace OpenQA.Selenium.DevTools.V113
namespace OpenQA.Selenium.DevTools.V116
{
/// <summary>
/// Class containing the domain implementation for version 113 of the DevTools Protocol.
/// Class containing the domain implementation for version 116 of the DevTools Protocol.
/// </summary>
public class V113Domains : DevToolsDomains
public class V116Domains : DevToolsDomains
{
private DevToolsSessionDomains domains;

public V113Domains(DevToolsSession session)
public V116Domains(DevToolsSession session)
{
this.domains = new DevToolsSessionDomains(session);
}

/// <summary>
/// Gets the DevTools Protocol version for which this class is valid.
/// </summary>
public static int DevToolsVersion => 113;
public static int DevToolsVersion => 116;

/// <summary>
/// Gets the version-specific domains for the DevTools session. This value must be cast to a version specific type to be at all useful.
Expand All @@ -46,21 +46,21 @@ public V113Domains(DevToolsSession session)
/// <summary>
/// Gets the object used for manipulating network information in the browser.
/// </summary>
public override DevTools.Network Network => new V113Network(domains.Network, domains.Fetch);
public override DevTools.Network Network => new V116Network(domains.Network, domains.Fetch);

/// <summary>
/// Gets the object used for manipulating the browser's JavaScript execution.
/// </summary>
public override JavaScript JavaScript => new V113JavaScript(domains.Runtime, domains.Page);
public override JavaScript JavaScript => new V116JavaScript(domains.Runtime, domains.Page);

/// <summary>
/// Gets the object used for manipulating DevTools Protocol targets.
/// </summary>
public override DevTools.Target Target => new V113Target(domains.Target);
public override DevTools.Target Target => new V116Target(domains.Target);

/// <summary>
/// Gets the object used for manipulating the browser's logs.
/// </summary>
public override DevTools.Log Log => new V113Log(domains.Log);
public override DevTools.Log Log => new V116Log(domains.Log);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="V113JavaScript.cs" company="WebDriver Committers">
// <copyright file="V116JavaScript.cs" company="WebDriver Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
Expand All @@ -18,25 +18,25 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using OpenQA.Selenium.DevTools.V113.Page;
using OpenQA.Selenium.DevTools.V113.Runtime;
using OpenQA.Selenium.DevTools.V116.Page;
using OpenQA.Selenium.DevTools.V116.Runtime;

namespace OpenQA.Selenium.DevTools.V113
namespace OpenQA.Selenium.DevTools.V116
{
/// <summary>
/// Class containing the JavaScript implementation for version 113 of the DevTools Protocol.
/// Class containing the JavaScript implementation for version 116 of the DevTools Protocol.
/// </summary>
public class V113JavaScript : JavaScript
public class V116JavaScript : JavaScript
{
private RuntimeAdapter runtime;
private PageAdapter page;

/// <summary>
/// Initializes a new instance of the <see cref="V113JavaScript"/> class.
/// Initializes a new instance of the <see cref="V116JavaScript"/> class.
/// </summary>
/// <param name="runtime">The DevTools Protocol adapter for the Runtime domain.</param>
/// <param name="page">The DevTools Protocol adapter for the Page domain.</param>
public V113JavaScript(RuntimeAdapter runtime, PageAdapter page)
public V116JavaScript(RuntimeAdapter runtime, PageAdapter page)
{
this.runtime = runtime;
this.page = page;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="V113Log.cs" company="WebDriver Committers">
// <copyright file="V116Log.cs" company="WebDriver Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
Expand All @@ -20,22 +20,22 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using OpenQA.Selenium.DevTools.V113.Log;
using OpenQA.Selenium.DevTools.V116.Log;

namespace OpenQA.Selenium.DevTools.V113
namespace OpenQA.Selenium.DevTools.V116
{
/// <summary>
/// Class containing the browser's log as referenced by version 113 of the DevTools Protocol.
/// Class containing the browser's log as referenced by version 116 of the DevTools Protocol.
/// </summary>
public class V113Log : DevTools.Log
public class V116Log : DevTools.Log
{
private LogAdapter adapter;

/// <summary>
/// Initializes a new instance of the <see cref="V113Log"/> class.
/// Initializes a new instance of the <see cref="V116Log"/> class.
/// </summary>
/// <param name="adapter">The adapter for the Log domain.</param>
public V113Log(LogAdapter adapter)
public V116Log(LogAdapter adapter)
{
this.adapter = adapter;
this.adapter.EntryAdded += OnAdapterEntryAdded;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="V113Network.cs" company="WebDriver Committers">
// <copyright file="V116Network.cs" company="WebDriver Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
Expand All @@ -20,25 +20,25 @@
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium.DevTools.V113.Fetch;
using OpenQA.Selenium.DevTools.V113.Network;
using OpenQA.Selenium.DevTools.V116.Fetch;
using OpenQA.Selenium.DevTools.V116.Network;

namespace OpenQA.Selenium.DevTools.V113
namespace OpenQA.Selenium.DevTools.V116
{
/// <summary>
/// Class providing functionality for manipulating network calls using version 113 of the DevTools Protocol
/// Class providing functionality for manipulating network calls using version 116 of the DevTools Protocol
/// </summary>
public class V113Network : DevTools.Network
public class V116Network : DevTools.Network
{
private FetchAdapter fetch;
private NetworkAdapter network;

/// <summary>
/// Initializes a new instance of the <see cref="V113Network"/> class.
/// Initializes a new instance of the <see cref="V116Network"/> class.
/// </summary>
/// <param name="network">The adapter for the Network domain.</param>
/// <param name="fetch">The adapter for the Fetch domain.</param>
public V113Network(NetworkAdapter network, FetchAdapter fetch)
public V116Network(NetworkAdapter network, FetchAdapter fetch)
{
this.network = network;
this.fetch = fetch;
Expand Down Expand Up @@ -80,12 +80,12 @@ public override async Task DisableNetwork()
/// <returns>A task that represents the asynchronous operation.</returns>
public override async Task EnableFetchForAllPatterns()
{
await fetch.Enable(new OpenQA.Selenium.DevTools.V113.Fetch.EnableCommandSettings()
await fetch.Enable(new OpenQA.Selenium.DevTools.V116.Fetch.EnableCommandSettings()
{
Patterns = new OpenQA.Selenium.DevTools.V113.Fetch.RequestPattern[]
Patterns = new OpenQA.Selenium.DevTools.V116.Fetch.RequestPattern[]
{
new OpenQA.Selenium.DevTools.V113.Fetch.RequestPattern() { UrlPattern = "*", RequestStage = RequestStage.Request },
new OpenQA.Selenium.DevTools.V113.Fetch.RequestPattern() { UrlPattern = "*", RequestStage = RequestStage.Response }
new OpenQA.Selenium.DevTools.V116.Fetch.RequestPattern() { UrlPattern = "*", RequestStage = RequestStage.Request },
new OpenQA.Selenium.DevTools.V116.Fetch.RequestPattern() { UrlPattern = "*", RequestStage = RequestStage.Response }
},
HandleAuthRequests = true
});
Expand Down Expand Up @@ -208,9 +208,9 @@ public override async Task ContinueWithAuth(string requestId, string userName, s
await fetch.ContinueWithAuth(new ContinueWithAuthCommandSettings()
{
RequestId = requestId,
AuthChallengeResponse = new V113.Fetch.AuthChallengeResponse()
AuthChallengeResponse = new V116.Fetch.AuthChallengeResponse()
{
Response = V113.Fetch.AuthChallengeResponseResponseValues.ProvideCredentials,
Response = V116.Fetch.AuthChallengeResponseResponseValues.ProvideCredentials,
Username = userName,
Password = password
}
Expand All @@ -227,9 +227,9 @@ public override async Task CancelAuth(string requestId)
await fetch.ContinueWithAuth(new ContinueWithAuthCommandSettings()
{
RequestId = requestId,
AuthChallengeResponse = new OpenQA.Selenium.DevTools.V113.Fetch.AuthChallengeResponse()
AuthChallengeResponse = new OpenQA.Selenium.DevTools.V116.Fetch.AuthChallengeResponse()
{
Response = V113.Fetch.AuthChallengeResponseResponseValues.CancelAuth
Response = V116.Fetch.AuthChallengeResponseResponseValues.CancelAuth
}
});
}
Expand All @@ -245,13 +245,16 @@ public override async Task AddResponseBody(HttpResponseData responseData)
if (responseData.StatusCode < 300 || responseData.StatusCode > 399)
{
var bodyResponse = await fetch.GetResponseBody(new Fetch.GetResponseBodyCommandSettings() { RequestId = responseData.RequestId });
if (bodyResponse.Base64Encoded)
if (bodyResponse != null)
{
responseData.Body = Encoding.UTF8.GetString(Convert.FromBase64String(bodyResponse.Body));
}
else
{
responseData.Body = bodyResponse.Body;
if (bodyResponse.Base64Encoded)
{
responseData.Body = Encoding.UTF8.GetString(Convert.FromBase64String(bodyResponse.Body));
}
else
{
responseData.Body = bodyResponse.Body;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="V113Target.cs" company="WebDriver Committers">
// <copyright file="V116Target.cs" company="WebDriver Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
Expand All @@ -21,22 +21,22 @@
using System.Collections.ObjectModel;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium.DevTools.V113.Target;
using OpenQA.Selenium.DevTools.V116.Target;

namespace OpenQA.Selenium.DevTools.V113
namespace OpenQA.Selenium.DevTools.V116
{
/// <summary>
/// Class providing functionality for manipulating targets for version 113 of the DevTools Protocol
/// Class providing functionality for manipulating targets for version 116 of the DevTools Protocol
/// </summary>
public class V113Target : DevTools.Target
public class V116Target : DevTools.Target
{
private TargetAdapter adapter;

/// <summary>
/// Initializes a new instance of the <see cref="V113Target"/> class.
/// Initializes a new instance of the <see cref="V116Target"/> class.
/// </summary>
/// <param name="adapter">The adapter for the Target domain.</param>
public V113Target(TargetAdapter adapter)
public V116Target(TargetAdapter adapter)
{
this.adapter = adapter;
adapter.DetachedFromTarget += OnDetachedFromTarget;
Expand Down
14 changes: 7 additions & 7 deletions dotnet/src/webdriver/WebDriver.csproj.prebuild.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v85\DevToolsSession
popd
)

if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v113\DevToolsSessionDomains.cs" (
echo Generating CDP code for version 113
pushd "%1..\..\.."
bazel build //dotnet/src/webdriver/cdp:generate-v113
popd
)

if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v114\DevToolsSessionDomains.cs" (
echo Generating CDP code for version 114
pushd "%1..\..\.."
Expand All @@ -47,3 +40,10 @@ if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v115\DevToolsSessio
bazel build //dotnet/src/webdriver/cdp:generate-v115
popd
)

if not exist "%1..\..\..\bazel-bin\dotnet\src\webdriver\cdp\v116\DevToolsSessionDomains.cs" (
echo Generating CDP code for version 116
pushd "%1..\..\.."
bazel build //dotnet/src/webdriver/cdp:generate-v116
popd
)
12 changes: 6 additions & 6 deletions dotnet/src/webdriver/WebDriver.csproj.prebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ then
bazel build //dotnet/src/webdriver/cdp:generate-v85
fi

if [[ ! -f "$1../../../bazel-bin/dotnet/src/webdriver/cdp/v113/DevToolsSessionDomains.cs" ]]
then
echo "Generating CDP code for version 113"
bazel build //dotnet/src/webdriver/cdp:generate-v113
fi

if [[ ! -f "$1../../../bazel-bin/dotnet/src/webdriver/cdp/v114/DevToolsSessionDomains.cs" ]]
then
echo "Generating CDP code for version 114"
Expand All @@ -40,3 +34,9 @@ then
echo "Generating CDP code for version 115"
bazel build //dotnet/src/webdriver/cdp:generate-v115
fi

if [[ ! -f "$1../../../bazel-bin/dotnet/src/webdriver/cdp/v116/DevToolsSessionDomains.cs" ]]
then
echo "Generating CDP code for version 116"
bazel build //dotnet/src/webdriver/cdp:generate-v116
fi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public StableChannelChromeDriver(ChromeOptions options)

public static ChromeOptions DefaultOptions
{
get { return new ChromeOptions() { AcceptInsecureCertificates = true }; }
get { return new ChromeOptions() { AcceptInsecureCertificates = true, BrowserVersion = "116" }; }
}
}
}
2 changes: 1 addition & 1 deletion dotnet/test/common/DevTools/DevToolsConsoleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace OpenQA.Selenium.DevTools
{
using CurrentCdpVersion = V115;
using CurrentCdpVersion = V116;

[TestFixture]
public class DevToolsConsoleTest : DevToolsTestFixture
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/common/DevTools/DevToolsLogTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace OpenQA.Selenium.DevTools
{
using CurrentCdpVersion = V115;
using CurrentCdpVersion = V116;

[TestFixture]
public class DevToolsLogTest : DevToolsTestFixture
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/common/DevTools/DevToolsNetworkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace OpenQA.Selenium.DevTools
{
using CurrentCdpVersion = V115;
using CurrentCdpVersion = V116;

[TestFixture]
public class DevToolsNetworkTest : DevToolsTestFixture
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/common/DevTools/DevToolsPerformanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace OpenQA.Selenium.DevTools
{
using CurrentCdpVersion = V115;
using CurrentCdpVersion = V116;

[TestFixture]
public class DevToolsPerformanceTest : DevToolsTestFixture
Expand Down
Loading

0 comments on commit 811bf14

Please sign in to comment.