报错org.openqa.selenium.WebDriverException: disconnected: unable to connect to renderer解决方法

做自动化时经常会遇到不兼容的问题,比如以下简单的脚本,主要是打开浏览器,然后最大化窗口,打开百度,输入内容搜索,代码如下:

package com.gs.selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class demo1 {

    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "E:\\ware\\selenium\\chromedriver_win32\\chromedriver.exe");
        ChromeOptions options = new ChromeOptions();
        options.addArguments("disable-infobars");// 设置chrome浏览器的参数,使其不弹框提示(chrome正在受自动测试软件的控制)

        WebDriver dr = new ChromeDriver(options);
        dr.manage().window().maximize();// 最大化浏览器
        dr.get("https://www.baidu.com");// 打开要测试的网址,比如百度

        dr.findElement(By.id("kw")).sendKeys("hello");// 输入搜索关键字
        System.out.print("打开网页");
        try {
            Thread.sleep(6000);
        } catch (InterruptedException e) {
            // TODO 自动生成的 catch 块
            e.printStackTrace();
        }
        dr.close();//关闭浏览器
    }

selenium 3.7版本放大浏览器窗口报错如下

报错:Exception in thread "main" org.openqa.selenium.WebDriverException: disconnected: unable to connect to renderer

查看报错,脚本运行到窗口最大化时出现错误的,经过仔细分析,发现chrom版本是62,与chromedriver不兼容的问题造成的。

解决方法:

去如下网址下载最下的chromedriver:

https://npm.taobao.org/mirrors/chromedriver/

下载后在运行以上脚本,问题顺利解决。

最后附上java工程jar包图:

时间: 2024-08-06 00:52:58

报错org.openqa.selenium.WebDriverException: disconnected: unable to connect to renderer解决方法的相关文章

[python] disconnected: unable to connect to renderer解决方法

用selenium时报错,原因是chrome自动更新,与chromedriver的版本不兼容造成. 解决办法: 查看chromedriver与chrome版本映射关系并下载:http://blog.csdn.net/huilan_same/article/details/51896672

selenium,在Eclipse中打开fireFox浏览器报错:org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

1. 相信很多同学刚接触selenium时,在Eclipse中打开fireFox浏览器是报报错:org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:...(异常代码太多此处省略) 在网上找了好多方法都是不能解决问题,结果是焦头烂额! 2.其实这是selenium的jar包和

Selenium2学习-038-firefox、webdriver版本不对称问题解决:org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055

今天有个朋友在群里问,为何脚本运行不通过,其脚本操作步骤简单描述如下: 1.启动火狐浏览器 2.打开百度 3.查询框输入关键字 4.点击按钮[百度一下] 脚本挺简单的,其给出的应用报错信息如下所示: [TestNG] Running: C:\Users\jiwei.xu\AppData\Local\Temp\testng-eclipse--429788523\testng-customsuite.xml org.openqa.selenium.firefox.NotConnectedExcept

WebDriver:org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

今天尝试最新的webDriver与fireFox搭配: 运行代码时出现如下的问题,但是浏览器却可以打开: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewPro

powerDesigner 连接Oracle 报Unable to connect SQLState=08004 解决方法

powerDesigner 报Unable to connect SQLState=08004 解决方法 环境:win7(64) powersigner 15 oracle 10G 错误提示: Unable to connect SQLState=08004 [Oracle][ODBC][Ora]ORA-12154:TNS:无法解析指定的连接标示符 解决方法: 看看是不是把powerDesigner安装在了有空格的目录下,如果是重新安装在非空目录即可. 分类: windows 7 powerDe

selenium-python:运行后报浏览器不兼容 disconnected: unable to connect to renderer

今天编写代码的过程中,遇到提示浏览器兼容性问题,找到的解决方法如下: 不多说,先上代码和错误截图: 从上图的错误信息可以得知,在将窗口最大化时,出现:unable to connect to renderer; 原因是浏览器的版本和浏览器驱动的版本不兼容: 故需要找新版本的浏览器驱动chromedriver,下载时间上传最新版本 下载地址: https://npm.taobao.org/mirrors/chromedriver/ 下载完成后,替换到python的安装目录 下:如下图: 然后,再次

我的Android进阶之旅------>Android无第三方Jar包的源代报错:The current class path entry belongs to container ...的解决方法

今天使用第三方Jar包afinal.jar时候,想看一下源代码,无法看 然后像添加jar对应的源码包,也无法添加相应的源代码,报错如下:The current class path entry belongs to container 'Android Dependencies' which does not allow user modifications to source attachments on its entries . 如下图所示: 解决方法: 1.接着在工程目录下新建一个lib

Https协议报错:com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl解决方法

旭日Follow_24 的CSDN 博客 ,全文地址请点击: https://blog.csdn.net/xuri24/article/details/82220333 所用应用服务器:JBoss服务器 jdk环境:jdk1.6 通信协议:http/https 场景:本地项目对接外部项目(接口编程),尤其银行对接等: 使用外部系统提供的sdk,sdk中封装好了http通信协议等.使用sdk进行调用正常,当导入本地项目对接时,调用请求出现报错: sun.net.www.protocol.http.

报错Cannot determine embedded database driver class for database type NONE解决方法

由于我不需要数据库,启动springboot报错: Cannot determine embedded database driver class for database type NONE If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you ma