How to hide Command prompt in Microsoft Edge SeleniumTools

Viewed 1049

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?

1 Answers

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);
Related