安装selenium-webdriver

npm i selenium-webdriver

当前安装版本:

"selenium-webdriver": "^4.0.0-alpha.7"
 
运行代码:node baidu.js
baidu.js:
var webdriver = require("selenium-webdriver"),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder().forBrowser("chrome").build(); driver.get("https://www.baidu.com");
driver.findElement(By.id("kw")).sendKeys("webdriver");
driver.findElement(By.id("su")).click();
driver.wait(until.titleIs("webdriver_百度搜索"), 1000);
// driver.quit();

参考:https://stackoverflow.com/questions/48791928/error-from-selenium-unhandledpromiserejectionwarning-error-econnrefused-conne

问题分析:可能是因为当前的 selenium-webdriver 是 alpha 版本导致了报错

问题解决:

卸载当前的 selenium-webdriver 版本    npm uninstall selenium-webdriver

下载低一级版本 npm install selenium-webdriver@3

Node + Selenium 报错 UnhandledPromiseRejectionWarning: Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:5319的更多相关文章

  1. 解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist

    解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist 早上在linux下用selenium启动Chro ...

  2. 运行 puppeteer 报错 chrome: error while loading shared libraries: libpangocairo-1.0.so.0: cannot open shared object file: No such file or directory

    运行 puppeteer 报错 chrome: error while loading shared libraries: libpangocairo-1.0.so.0: cannot open sh ...

  3. python selenium 报错unknown error: cannot focus element 解决办法

    登录框由于js限制,定位到元素后无法sendkey ,sendky报错如下: selenium.common.exceptions.WebDriverException: Message: unkno ...

  4. Jenkins执行selenium报错unknown error: cannot find Chrome binary

    问题描述:在Pycharm中执行selenium测试用例,可以正常运行, 集成在Jenkins中,构建时,发现构建成功,但是查看Console Output,报错:unknown error: can ...

  5. puppeteer报错 UnhandledPromiseRejectionWarning: Error: Protocol error (Page.getLayoutMetrics): Target closed.

    puppeteer运行时报错: UnhandledPromiseRejectionWarning: Error: Protocol error (Page.getLayoutMetrics): Tar ...

  6. windows10下安装docker报错:error during connect

    详细报错信息如下: C:\Users\zig>docker info error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engin ...

  7. Shell脚本报错--syntax error near unexpected token for((i=0;i<$length;i++))

    现象: shell脚本使用Nodepad++进行本地编辑,在编辑后上传到linux机器进行执行时提示“syntax error near unexpected token for((i=0;i< ...

  8. win7安装docker报错:error during connect: Get http ..... the system cannot find the file specified

    因为是win7 所以使用了官方网站的dockertoolbox 安装一路顺利,结果启动就报上面的错误, 因为安装包附带安装了virtualbox 上面的错误后来排查出来是 virtualboox的问题 ...

  9. 11gR2数据库日志报错:Fatal NI connect error 12170、

    11gR2数据库日志报错:Fatal NI connect error 12170.TNS-12535.TNS-00505 [问题点数:100分,结帖人MarkIII]             不显示 ...

随机推荐

  1. DEV C++自定义函数顺序与printf用法

    #include <stdio.h> //int gys(int a,int b);//函数声明 int main() { int a = 520; int c1=98; int c2=5 ...

  2. dart pub上传失败如何解决

    问题: Flutter Exception: Pub will wait for a while before trying to connect again. 解决 1.设置终端代理 export ...

  3. django中路由配置的正则

    在django中配置路由遇到正则的坑: django2.x版本中使用re_path来进行正则表达式的匹配 用法如下: from Django.urls import re.path(导入re_path ...

  4. tomcat与springmvc 结合 之---第20篇 springmvc 对于加载的bean对象存储在哪里

  5. thinkphp 事物回滚

    1 $m=D('YourModel');//或者是M(); 2 $m2=D('YouModel2'); 3 $m->startTrans();//在第一个模型里启用就可以了,或者第二个也行 4 ...

  6. Hadoop (8088)未授权访问

    cd /vulhub/hadoop/unauthorized-yarn 加速下载环境 sudo vim /etc/docker/daemon.json 添加 {"registry-mirro ...

  7. ffmpeg 任意文件读取漏洞/SSRF漏洞 (CVE-2016-1897/CVE-2016-1898)

    影响版本 在FFMpeg2.X poc http://192.168.49.2:8000/?name={%25%20for%20c%20in%20[].__class__.__base__.__sub ...

  8. Tr0ll靶机

    一.主机探测 二.信息收集 进入21端口 发现文件并下载 下载文件 作为字典进行登录爆破 用字典爆破 ssh登录 查找信息   /etc/init.d/ssh start scp root@192.1 ...

  9. yum 卸载

    # yum list installed | grep [软件名] #yum -y remove [软件名]

  10. php预定义常量运用

    当前url 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; 当前文件路径 dirname(__FILE__)header(" ...