-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathBaseFixture.cs
More file actions
35 lines (28 loc) · 887 Bytes
/
BaseFixture.cs
File metadata and controls
35 lines (28 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using OpenQA.Selenium.Remote;
using Newtonsoft.Json.Linq;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium;
using BrowserStack;
namespace XUnit_BrowserStack
{
public class BaseFixture : IDisposable
{
private RemoteWebDriver? WebDriver;
public RemoteWebDriver GetDriver(string platform, string profile)
{
// Create Desired Cappabilities for WebDriver
DriverOptions desiredCapabilities = new OpenQA.Selenium.Chrome.ChromeOptions();
// Create RemoteWebDriver instance
WebDriver = new RemoteWebDriver(new Uri($"http://localhost:4444/wd/hub"), desiredCapabilities);
return WebDriver;
}
public void Dispose()
{
if (WebDriver is not null)
{
WebDriver.Quit();
WebDriver.Dispose();
}
}
}
}