Task<ChromeDriver> PrepareDriverAsync(int portValue)
{
var options = new ChromeOptions();
options.AddArguments(new List<string> { "--headless", "--hide-scrollbars" });
options.PageLoadStrategy = PageLoadStrategy.Normal;
ChromeDriverService service = await CreateChromeDriverServiceAysnc();
service.Port = portValue;
var driver = new ChromeDriver(service, options);
return driver;
}
Task<ChromeDriverService> CreateChromeDriverServiceAysnc()
{
ChromeDriverService chromeDriverService = null;
try
{
chromeDriverService = ChromeDriverService.CreateDefaultService();
break;
}
catch (DriverServiceNotFoundException)
{
}
return chromeDriverService;
}
Task<ChromeDriver> PrepareDriverAsync(int portValue)
{
var options = new ChromeOptions();
options.AddArguments(new List<string> { "--headless", "--hide-scrollbars" });
options.PageLoadStrategy = PageLoadStrategy.Normal;
ChromeDriverService service = await CreateChromeDriverServiceAysnc();
service.Port = portValue;
var driver = new ChromeDriver(service, options);
return driver;
}
Task<ChromeDriverService> CreateChromeDriverServiceAysnc()
{
ChromeDriverService chromeDriverService = null;
try
{
chromeDriverService = ChromeDriverService.CreateDefaultService();
break;
}
catch (DriverServiceNotFoundException)
{
}
return chromeDriverService;
}