我收到此错误
(node:4369) UnhandledPromiseRejectionWarning: SessionNotCreatedError: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'ubuntu-xenial', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-157-generic', java.version: '1.8.0_201'
Driver info: driver.version: unknown
remote stacktrace:
at Object.checkLegacyResponse (/../node_modules/selenium-webdriver/lib/error.js:585:15)
at parseHttpResponse (/../node_modules/selenium-webdriver/lib/http.js:551:13)
at Executor.execute (/../node_modules/selenium-webdriver/lib/http.js:486:26)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:4369) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4369) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我正在尝试运行(test / somehello.js)
const {Builder, By, Key, until} = require('selenium-webdriver');
(async function example() {
let driver = await new Builder().forBrowser('firefox')
.usingServer('http://localhost:4444/wd/hub')
.build();
try {
await driver.get('http://www.google.com/ncr');
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
console.log('hwllo world');
} finally {
await driver.quit();
}
})();
Chrome和Firefox驱动程序位于'/ usr / bin'中。
我正在使用运行Ubuntu的Vagrant盒。
运行测试代码时,可以显示硒独立服务器(3.141.59.jar)日志
08:50:35.436信息[ActiveSessionFactory.apply]-功能为:{ “ browserName”:“ firefox” }
任何帮助将不胜感激。