1 回答
TA贡献1804条经验 获得超7个赞
这是你如何做到的
require('chromedriver');
const path = require('path');
const wd = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
var builder = new wd.Builder();
var options = new chrome.Options();
var prefs = new wd.logging.Preferences();
var driver;
prefs.setLevel(wd.logging.Type.BROWSER, wd.logging.Level.ALL);
options.setLoggingPrefs(prefs);
driver = builder
.forBrowser(wd.Browser.CHROME)
.setChromeOptions(options)
.build();
driver
.get(`file://${path.resolve(__dirname, './page.html')}`)
.then(() => driver.manage().logs().get(wd.logging.Type.BROWSER))
.then((logs) => {
console.log(logs);
})
.then(() => driver.quit());
添加回答
举报