Hi i'm using selenium to open edge(Chromium) then navigate to a URL. written in c# windowsform application
Here is the code
IWebDriver edgeDriver;
var options = new EdgeOptions();
options.UseChromium = true;
edgeDriver = new EdgeDriver(options);
edgeDriver.Navigate().GoToUrl(@Config.SpcUrl);
it is working fine
what i have try is this to hide the command prompt
IWebDriver edgeDriver;
var chromeDriverService = EdgeDriverService.CreateDefaultService();
chromeDriverService.HideCommandPromptWindow = true;
var options = new EdgeOptions();
options.UseChromium = true;
edgeDriver = new EdgeDriver(chromeDriverService ,options);
edgeDriver.Navigate().GoToUrl(@Config.SpcUrl);
but it gives me an error of
An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in Microsoft.Edge.SeleniumTools.dll
Additional information: options.UseChromium must be set to false when using an Edge Legacy driver service.
What i'm doing wrong or i'm missing something?
Solve i use CreateChromiumService
insted of EdgeOptions
so the final code looks like this
var chromeDriverService = EdgeDriverService.CreateChromiumService();
chromeDriverService.HideCommandPromptWindow = true;
var options = new EdgeOptions();
options.UseChromium = true;
edgeDriver = new EdgeDriver(chromeDriverService, options);
edgeDriver.Navigate().GoToUrl(@Config.SpcUrl);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.