Stub Gen Selenium Tests
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
|
||||
namespace AOW4.SeleniumTests.Driver;
|
||||
|
||||
public static class DriverFactory
|
||||
{
|
||||
public static IWebDriver CreateChromeDriver()
|
||||
{
|
||||
var options = new ChromeOptions();
|
||||
var headless = Environment.GetEnvironmentVariable("HEADLESS");
|
||||
if (!string.IsNullOrEmpty(headless) && (headless == "1" || headless.Equals("true", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
options.AddArgument("--headless=new");
|
||||
}
|
||||
|
||||
options.AddArgument("--disable-gpu");
|
||||
options.AddArgument("--no-sandbox");
|
||||
options.AddArgument("--disable-dev-shm-usage");
|
||||
|
||||
var service = ChromeDriverService.CreateDefaultService();
|
||||
service.HideCommandPromptWindow = true;
|
||||
|
||||
return new ChromeDriver(service, options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user