Skip to content

Commit 3dce554

Browse files
authored
Update Selenium version to 4.23.0 (#259)
* Update Selenium version to 4.23.0 +semver:feature - Add async methods to BrowserNavigation proxy * Update the pipeline, add missed BackAsync implementation
1 parent 77f9255 commit 3dce554

File tree

11 files changed

+96
-15
lines changed

11 files changed

+96
-15
lines changed

Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
</ItemGroup>
8787

8888
<ItemGroup>
89-
<PackageReference Include="Aquality.Selenium.Core" Version="3.0.9" />
89+
<PackageReference Include="Aquality.Selenium.Core" Version="3.0.12" />
9090
<PackageReference Include="OpenCvSharp4.runtime.osx_arm64" Version="4.8.1-rc" />
9191
<PackageReference Include="WebDriverManager" Version="2.17.4" />
9292
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20240616" />

Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml

+27-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Aquality.Selenium/src/Aquality.Selenium/Browsers/BrowserNavigation.cs

+53
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Aquality.Selenium.Core.Localization;
22
using OpenQA.Selenium;
33
using System;
4+
using System.Threading.Tasks;
45

56
namespace Aquality.Selenium.Browsers
67
{
@@ -28,6 +29,16 @@ public void Back()
2829
driver.Navigate().Back();
2930
}
3031

32+
/// <summary>
33+
/// Move back a single entry in the browser's history as an asynchronous task.
34+
/// </summary>
35+
/// <returns>A task object representing the asynchronous operation.</returns>
36+
public Task BackAsync()
37+
{
38+
Logger.Info("loc.browser.back");
39+
return driver.Navigate().BackAsync();
40+
}
41+
3142
/// <summary>
3243
/// Navigates forward.
3344
/// </summary>
@@ -37,6 +48,16 @@ public void Forward()
3748
driver.Navigate().Forward();
3849
}
3950

51+
/// <summary>
52+
/// Move a single "item" forward in the browser's history as an asynchronous task.
53+
/// </summary>
54+
/// <returns>A task object representing the asynchronous operation.</returns>
55+
public Task ForwardAsync()
56+
{
57+
Logger.Info("loc.browser.forward");
58+
return driver.Navigate().ForwardAsync();
59+
}
60+
4061
/// <summary>
4162
/// Navigates to desired url.
4263
/// </summary>
@@ -77,6 +98,28 @@ public void GoToUrl(Uri url)
7798
}
7899
}
79100

101+
/// <summary>
102+
/// Navigate to a url as an asynchronous task.
103+
/// </summary>
104+
/// <param name="url">String representation of where you want the browser to go.</param>
105+
/// <returns>A task object representing the asynchronous operation.</returns>
106+
public Task GoToUrlAsync(string url)
107+
{
108+
InfoLocNavigate(url);
109+
return driver.Navigate().GoToUrlAsync(url);
110+
}
111+
112+
/// <summary>
113+
/// Navigate to a url as an asynchronous task.
114+
/// </summary>
115+
/// <param name="url">Uri object of where you want the browser to go.</param>
116+
/// <returns>A task object representing the asynchronous operation.</returns>
117+
public Task GoToUrlAsync(Uri url)
118+
{
119+
InfoLocNavigate(url.ToString());
120+
return driver.Navigate().GoToUrlAsync(url);
121+
}
122+
80123
/// <summary>
81124
/// Refreshes current page.
82125
/// </summary>
@@ -86,6 +129,16 @@ public void Refresh()
86129
driver.Navigate().Refresh();
87130
}
88131

132+
/// <summary>
133+
/// Reload the current page as an asynchronous task.
134+
/// </summary>
135+
/// <returns>A task object representing the asynchronous operation.</returns>
136+
public Task RefreshAsync()
137+
{
138+
Logger.Info("loc.browser.refresh");
139+
return driver.Navigate().RefreshAsync();
140+
}
141+
89142
private void InfoLocNavigate(string url)
90143
{
91144
Logger.Info("loc.browser.navigate", url);

Aquality.Selenium/src/Aquality.Selenium/Browsers/BrowserWindowNavigation.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using OpenQA.Selenium;
33
using System;
44
using System.Collections.Generic;
5-
using System.Linq;
65

76
namespace Aquality.Selenium.Browsers
87
{

Aquality.Selenium/src/Aquality.Selenium/Configurations/WebDriverSettings/FirefoxSettings.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public FirefoxSettings(ISettingsFile settingsFile) : base(settingsFile)
2727

2828
protected override IDictionary<string, Action<DriverOptions, object>> KnownCapabilitySetters => new Dictionary<string, Action<DriverOptions, object>>
2929
{
30-
{ "binary", (options, value) => ((FirefoxOptions) options).BrowserExecutableLocation = value.ToString() },
31-
{ "firefox_binary", (options, value) => ((FirefoxOptions) options).BrowserExecutableLocation = value.ToString() },
30+
{ "binary", (options, value) => ((FirefoxOptions) options).BinaryLocation = value.ToString() },
31+
{ "firefox_binary", (options, value) => ((FirefoxOptions) options).BinaryLocation = value.ToString() },
3232
{ "firefox_profile", (options, value) => ((FirefoxOptions) options).Profile = new FirefoxProfileManager().GetProfile(value.ToString()) },
3333
{ "log", (options, value) => ((FirefoxOptions) options).LogLevel = value.ToEnum<FirefoxDriverLogLevel>() }
3434
};

Aquality.Selenium/src/Aquality.Selenium/Elements/Actions/MouseActions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void DoubleClick()
5050
}
5151

5252
/// <summary>
53-
/// Perfroms right click on element.
53+
/// Performs right click on element.
5454
/// </summary>
5555
public void RightClick()
5656
{

Aquality.Selenium/src/Aquality.Selenium/Elements/Element.cs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using ICoreElementFactory = Aquality.Selenium.Core.Elements.Interfaces.IElementFactory;
1717
using ICoreElementFinder = Aquality.Selenium.Core.Elements.Interfaces.IElementFinder;
1818
using ICoreElementStateProvider = Aquality.Selenium.Core.Elements.Interfaces.IElementStateProvider;
19-
using System.Collections.Generic;
2019

2120
namespace Aquality.Selenium.Elements
2221
{

Aquality.Selenium/tests/Aquality.Selenium.Tests/Aquality.Selenium.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<ItemGroup>
3232
<PackageReference Include="nunit" Version="4.1.0" />
33-
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0">
33+
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
3434
<PrivateAssets>all</PrivateAssets>
3535
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3636
</PackageReference>

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/DevToolsEmulationTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ public void Should_BePossibleTo_SetAndClearDeviceMetricsOverride_WithVersionSpec
5959
{
6060
void setAction(long width, long height, bool isMobile, double scaleFactor)
6161
{
62-
var parameters = new OpenQA.Selenium.DevTools.V125.Emulation.SetDeviceMetricsOverrideCommandSettings
62+
var parameters = new OpenQA.Selenium.DevTools.V127.Emulation.SetDeviceMetricsOverrideCommandSettings
6363
{
64-
DisplayFeature = new OpenQA.Selenium.DevTools.V125.Emulation.DisplayFeature
64+
DisplayFeature = new OpenQA.Selenium.DevTools.V127.Emulation.DisplayFeature
6565
{
66-
Orientation = OpenQA.Selenium.DevTools.V125.Emulation.DisplayFeatureOrientationValues.Horizontal
66+
Orientation = OpenQA.Selenium.DevTools.V127.Emulation.DisplayFeatureOrientationValues.Horizontal
6767
},
6868
Width = width,
6969
Height = height,

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Usecases/FileDownloadingTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using NUnit.Framework;
55
using OpenQA.Selenium;
66
using System;
7-
using System.Collections.Generic;
87

98
namespace Aquality.Selenium.Tests.Integration.Usecases
109
{

azure-pipelines.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ stages:
1515
displayName: Analyse code with SonarQube
1616

1717
steps:
18-
- task: SonarCloudPrepare@1
18+
- task: SonarCloudPrepare@2
1919
displayName: 'Prepare SonarCloud analysis'
2020
inputs:
2121
SonarCloud: 'SonarCloud'
2222
organization: 'aqualityautomation'
23+
scannerMode: 'MSBuild'
2324
projectKey: 'aquality-automation_aquality-selenium-dotnet'
2425
projectName: 'aquality-selenium-dotnet'
2526
projectVersion: '$(Build.BuildNumber)'
@@ -35,12 +36,16 @@ stages:
3536
projects: Aquality.Selenium/Aquality.Selenium.sln
3637
arguments: -c $(buildConfiguration)
3738

38-
- task: SonarCloudAnalyze@1
39+
- task: SonarCloudAnalyze@2
3940
displayName: 'Run SonarCloud code analysis'
4041
continueOnError: true
42+
inputs:
43+
jdkversion: 'JAVA_HOME_17_X64'
4144

42-
- task: SonarCloudPublish@1
45+
- task: SonarCloudPublish@2
4346
displayName: 'Publish SonarCloud quality gate results'
47+
inputs:
48+
pollingTimeoutSec: '300'
4449

4550
- job: tests
4651
displayName: Run tests

0 commit comments

Comments
 (0)