使用 Selenium JS Chrome Webdriver 时出错 [英] Error using Selenium JS Chrome Webdriver
问题描述
我喜欢使用 Selenium chromewebdriver 来测试应用程序.
I like to use Selenium chromewebdriver for testing an application.
我从本教程开始:https://code.google.com/p/selenium/wiki/WebDriverJs#Getting_Started
我下载了最新的 webdriver
并将其添加到路径中,然后我尝试执行您在入门部分看到的示例代码.我将代码添加到脚本中并尝试使用 > 执行它.node script.js
并收到以下错误消息:
I downloaded newest webdriver
and added it to path, then I tried to execute the sample code you see under getting started. I added the code to a script and tried to execute it with > node script.js
and got the following error message:
undefined:1178
vlog(2, () => this + ' scheduling notifications', this);
^
SyntaxError: Unexpected token )
at goog.loadModuleFromSource_ (C:\nodescripts\node_modules\selenium-webdriver\lib\goog\base.js:1123:19)
at Object.goog.loadModule (C:\nodescripts\node_modules\selenium-webdriver\lib\goog\base.js:1085:46)
at C:\nodescripts\node_modules\selenium-webdriver\lib\webdriver\promise.js:1:6
at Object.exports.runInContext (vm.js:64:17)
at Object.Context.closure.goog.retrieveAndExecModule_ (C:\nodescripts\node_modules\selenium-webdriver\_base.js:135:8)
at <anonymous>:1:6
at Object.exports.runInContext (vm.js:64:17)
at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (C:\nodescripts\node_modules\selenium-webdriver\_base.js:104:12)
at Object.goog.importScript_ (C:\nodescripts\node_modules\selenium-webdriver\lib\goog\base.js:879:9)
at Object.goog.importModule_ (C:\nodescripts\node_modules\selenium-webdriver\lib\goog\base.js:900:14)
推荐答案
@version 2.48.0 存在一个错误.我在 win 和 linux 上都试过,看到了同样的错误信息.尝试使用 2.47.0 版.
There is a bug @version 2.48.0. I tried both on win and on linux and saw the same error message. Try using version 2.47.0.
npm install selenium-webdriver@2.47.0
更新:更新你的 node.js.
Update: Update your node.js.
https://nodejs.org/download/release/latest/
这篇关于使用 Selenium JS Chrome Webdriver 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!