How to start ChromeDriver in headless mode

前端 未结 5 1705
天命终不由人
天命终不由人 2020-12-04 13:24

I want to try out headless chrome, but I am running into this issue, that I can\'t start the driver in headless mode. I was following google documentation. am I missing some

5条回答
  •  死守一世寂寞
    2020-12-04 13:54

    Below i have given how to set the headless to true for firefox and chrome browsers.

    FirefoxOptions ffopt = new FirefoxOptions();
    FirefoxOptions option = ffopt.setHeadless(true);
    WebDriver driver = new FirefoxDriver(option);
    
    
    ChromeOptions coptions = new ChromeOptions();
    ChromeOptions options = coptions.setHeadless(true);
    WebDriver driver = new ChromeDriver(options);
    

提交回复
热议问题