我在节点中使用selenium:
require('chromedriver');
var webdriver = require('selenium-webdriver'), By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
driver.get('http://www.google.com');
有没有办法如何传递命令行参数并使用无头模式启动chrome隐藏?
如何?
答案 0 :(得分:0)
你需要这样做
require('chromedriver');
var webdriver = require('selenium-webdriver'), By = webdriver.By,
until = webdriver.until, chrome = require("selenium-webdriver/chrome");
var driver = new webdriver.Builder()
.forBrowser('chrome')
.setChromeOptions(new chrome.Options().headless())
.build();
driver.get('http://www.google.com');