Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/dotnet/SeleniumDocs/BiDi/CDP/NetworkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using OpenQA.Selenium;
using OpenQA.Selenium.DevTools;
using System.Linq;
using OpenQA.Selenium.DevTools.V142.Network;
using OpenQA.Selenium.DevTools.V142.Performance;
using OpenQA.Selenium.DevTools.V145.Network;
using OpenQA.Selenium.DevTools.V145.Performance;


namespace SeleniumDocs.BiDi.CDP
Expand Down Expand Up @@ -109,9 +109,9 @@ public async Task PerformanceMetrics()
driver.Url = "https://www.selenium.dev/selenium/web/frameset.html";

var session = ((IDevTools)driver).GetDevToolsSession();
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V142.DevToolsSessionDomains>();
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V145.DevToolsSessionDomains>();

await domains.Performance.Enable(new OpenQA.Selenium.DevTools.V142.Performance.EnableCommandSettings());
await domains.Performance.Enable(new OpenQA.Selenium.DevTools.V145.Performance.EnableCommandSettings());
var metricsResponse =
await session.SendCommand<GetMetricsCommandSettings, GetMetricsCommandResponse>(
new GetMetricsCommandSettings()
Expand All @@ -130,8 +130,8 @@ await session.SendCommand<GetMetricsCommandSettings, GetMetricsCommandResponse>(
public async Task SetCookie()
{
var session = ((IDevTools)driver).GetDevToolsSession();
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V142.DevToolsSessionDomains>();
await domains.Network.Enable(new OpenQA.Selenium.DevTools.V142.Network.EnableCommandSettings());
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V145.DevToolsSessionDomains>();
await domains.Network.Enable(new OpenQA.Selenium.DevTools.V145.Network.EnableCommandSettings());

var cookieCommandSettings = new SetCookieCommandSettings
{
Expand Down
9 changes: 5 additions & 4 deletions examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
Expand Down Expand Up @@ -43,7 +44,7 @@ public void Arguments()
}

[TestMethod]
public void SetBrowserLocation()
public async Task SetBrowserLocation()
{
string userDataDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(userDataDir);
Expand All @@ -52,7 +53,7 @@ public void SetBrowserLocation()
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");

options.BinaryLocation = GetChromeLocation();
options.BinaryLocation = await GetChromeLocationAsync();

driver = new ChromeDriver(options);
}
Expand Down Expand Up @@ -157,13 +158,13 @@ private string GetLogLocation()
return _logLocation;
}

private static string GetChromeLocation()
private static async Task<string> GetChromeLocationAsync()
{
var options = new ChromeOptions
{
BrowserVersion = "stable"
};
return new DriverFinder(options).GetBrowserPath();
return await new DriverFinder(options).GetBrowserPathAsync();
}
}
}
9 changes: 5 additions & 4 deletions examples/dotnet/SeleniumDocs/Browsers/EdgeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chromium;
Expand Down Expand Up @@ -43,11 +44,11 @@ public void Arguments()
}

[TestMethod]
public void SetBrowserLocation()
public async Task SetBrowserLocation()
{
var options = new EdgeOptions();

options.BinaryLocation = GetEdgeLocation();
options.BinaryLocation = await GetEdgeLocationAsync();

driver = new EdgeDriver(options);
}
Expand Down Expand Up @@ -151,13 +152,13 @@ private string GetLogLocation()
return _logLocation;
}

private static string GetEdgeLocation()
private static async Task<string> GetEdgeLocationAsync()
{
var options = new EdgeOptions
{
BrowserVersion = "stable"
};
return new DriverFinder(options).GetBrowserPath();
return await new DriverFinder(options).GetBrowserPathAsync();
}
}
}
9 changes: 5 additions & 4 deletions examples/dotnet/SeleniumDocs/Browsers/FirefoxTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
Expand Down Expand Up @@ -48,11 +49,11 @@ public void Arguments()
}

[TestMethod]
public void SetBinary()
public async Task SetBinary()
{
var options = new FirefoxOptions();

options.BinaryLocation = GetFirefoxLocation();
options.BinaryLocation = await GetFirefoxLocationAsync();

driver = new FirefoxDriver(options);
}
Expand Down Expand Up @@ -197,13 +198,13 @@ private void SetWaitingDriver()
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2);
}

private static string GetFirefoxLocation()
private static async Task<string> GetFirefoxLocationAsync()
{
var options = new FirefoxOptions()
{
BrowserVersion = "stable"
};
return new DriverFinder(options).GetBrowserPath();
return await new DriverFinder(options).GetBrowserPathAsync();
}

private void ResetGlobalLog()
Expand Down
9 changes: 5 additions & 4 deletions examples/dotnet/SeleniumDocs/Drivers/ServiceTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
Expand All @@ -17,10 +18,10 @@ public void BasicService()

[TestMethodCustom]
[EnabledOnOs("OSX")]
public void DriverLocation()
public async Task DriverLocation()
{
var options = GetLatestChromeOptions();
var service = ChromeDriverService.CreateDefaultService(GetDriverLocation(options));
var service = ChromeDriverService.CreateDefaultService(await GetDriverLocationAsync(options));

driver = new ChromeDriver(service, options);
}
Expand All @@ -34,9 +35,9 @@ public void DriverPort()
driver = new ChromeDriver(service);
}

private static string GetDriverLocation(ChromeOptions options)
private static async Task<string> GetDriverLocationAsync(ChromeOptions options)
{
return new DriverFinder(options).GetDriverPath();
return await new DriverFinder(options).GetDriverPathAsync();
}

private static ChromeOptions GetLatestChromeOptions()
Expand Down
4 changes: 2 additions & 2 deletions examples/dotnet/SeleniumDocs/SeleniumDocs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.7.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.0" />
<PackageReference Include="Selenium.Support" Version="4.38.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.38.0" />
<PackageReference Include="Selenium.Support" Version="4.41.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.41.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Internal.Logging;
using OpenQA.Selenium.Manager;
using OpenQA.Selenium.Remote;
using System;
using System.IO;
Expand Down
Loading