Selenium hide cmd command debug window when ChromeDriver start

Selenium recently used for page automatically filling in a form, encountered a problem: how to hide cmd window, start ChromeDriver default debug window opens cmd

var the Option = new new ChromeOptions ();  
 // whether to hide the browser, if commented out, then will open the Google browser at startup, on the page can see the operation of filling orders, if canceled, only cmd window , Google browser occult run         
option.AddArgument ( " headless " ); 
option.AddArgument ( " window-size = 1920, 1080 " );

This is a digression, need to be set at, it is to let Google browser does not pop up, conceal run

//设置cmd窗口不弹出来
ChromeDriverService service = ChromeDriverService.CreateDefaultService(System.AppDomain.CurrentDomain.BaseDirectory.ToString());
service.HideCommandPromptWindow = true;
webDriver = new ChromeDriver(service, option);

 

Guess you like

Origin www.cnblogs.com/haibeike/p/Selenium.html