微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

node.js – SyntaxError:在严格模式下使用const?

我试图使用selenium-webdriver登录facebook.com。

var webdriver = require('selenium-webdriver'),By = require('selenium-webdriver').By,until = require('selenium-webdriver').until;

var driver = new webdriver.Builder()
    .forbrowser('firefox')
    .build();

driver.get('https://www.facebook.com/login');
driver.findElement(By.id('email')).sendKeys('****');
driver.findElement(By.id('pass')).sendKeys('*****');
driver.findElement(By.id('loginbutton')).click();

driver.findElement(By.linkText('Settings')).then(function(element) {
  console.log('Yes,found the element');
},function(error) {
  console.log('The element was not found,as expected');
});
driver.quit();

它给出错误

06001

node –version v0.10.37

npm –version1.4.28

量角器 – 版本3.2.2

selenium-webdriver@2.53.1

解决方法

更新nodejs解决了问题:

npm cache clean -f
npm install -g n
n stable
node --version
node app.js

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐