为什么我会用硒chromedriver得到这个错误?

时间:2018-05-10 07:26:39

标签: node.js selenium express selenium-webdriver selenium-chromedriver

执行以下代码后,它会打开chrome并且搜索栏已填充此data;,。我还没有在代码中的任何地方提到过这种情况。 此外,每次尝试运行代码时都会出现很少的错误。

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

var driver =new webdriver.Builder()
    .forBrowser('chrome')
    .build();

driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys('wiki');
driver.findElement(By.name('btnG')).click();
driver.wait(check_title,1000);

function check_title(){
  var promise = driver.getTitle().then((title)=>{
    if(title === 'wiki - Google Search'){
      console.log('success!');
      return true;
    }else{
      console.log("failed!!");
    }
  });
  return promise;
}

我收到此错误

 (node:15384) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:61227
    (node:15384) [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.
    (node:15384) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:61227
    (node:15384) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:61227
    (node:15384) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:61227
    (node:15384) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:61227

如何删除?

0 个答案:

没有答案