简体   繁体   中英

Selenium chrome driver to open website c# with headless

This is my code with open web.whatsapp.com url and I add argument "Headless" so not open page but give the selection of the which browser to open. So how to avoid browser selection and get page. but without "Headless" then easy to open webpage and not asking any option to selection

ChromeDriverService service = ChromeDriverService.CreateDefaultService();
service.HideCommandPromptWindow = true;

var options = new ChromeOptions();
options.AddArgument("headless");
Driver = new ChromeDriver(service, options);
Driver.Navigate().GoToUrl("https://web.whatsapp.com/");

图片

对我有用的是在论点前添加双破折号。

chromeOptions.AddArgument("--headless");

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM