Starta inte ny chromedriver för varje anrop
This commit is contained in:
@ -21,8 +21,6 @@ namespace StockDal
|
||||
public StringBuilder TextResults { get; set; }
|
||||
public bool ViewBrowser { get; set; }
|
||||
|
||||
|
||||
|
||||
public IWebDriver driver;
|
||||
|
||||
public StockMarketRepository()
|
||||
@ -160,13 +158,19 @@ namespace StockDal
|
||||
|
||||
if (ViewBrowser)
|
||||
{
|
||||
driver = new ChromeDriver(driverService);
|
||||
if (driver == null)
|
||||
{
|
||||
driver = new ChromeDriver(driverService);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var options = new ChromeOptions();
|
||||
options.AddArgument("headless");
|
||||
driver = new ChromeDriver(driverService, options);
|
||||
if (driver == null)
|
||||
{
|
||||
var options = new ChromeOptions();
|
||||
options.AddArgument("headless");
|
||||
driver = new ChromeDriver(driverService, options);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user