Tag: chrome web driver

使用Node.js上的Selenium Webdriver Chrome阅读控制台

我想在Node.js中使用Selenium Webdriver Chrome进入一个网页,填写一个input,单击一个button,然后检索浏览器控制台的内容。 我能够得到网页,填写input,然后单击button,但到目前为止我无法弄清楚如何检索控制台的内容。 我怎么做? 这是迄今为止的代码: const webdriver = require('selenium-webdriver'); const chromeDriver = require('selenium-webdriver/chrome'); const path = require('chromeDriver').path; const service = new chromeDriver.ServiceBuilder(path).build(); chromeDriver.setDefaultService(service); const { By, until } = webdriver; webdriver.promise.USE_PROMISE_MANAGER = false; const CHROME_BIN_PATH = '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'; const options = new chromeDriver.Options(); options.setChromeBinaryPath(CHROME_BIN_PATH); options.addArguments( 'headless', 'disable-gpu', ); const main = async () […]