Headless automation with Nodejs Selenium Webdriver

后端 未结 4 1664
眼角桃花
眼角桃花 2021-01-30 18:30

I am working with an automation tool which has to be deployed inside an ubuntu server, my wonder is if is possible to use chrome in a silent way with Selenium Webdriver.

4条回答
  •  温柔的废话
    2021-01-30 18:59

    Unfortunately the headless() method does not exist any more in Webdriver JS.

    Use

    const seleniumWebdriver = require('selenium-webdriver');
    const chrome = require('selenium-webdriver/chrome');
    
    var driver = new Builder().forBrowser('chrome')
                .setChromeOptions(new chrome.Options().addArguments('--headless'))
                .build();
    

    instead.

提交回复
热议问题