在写selenium的时候,发现很简单的case也报错
package com.lv.test;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Orders {
private WebDriver driver = new ChromeDriver();
String orderUrl="http://www.baidu.com";
@Test
public void OrdersPage(){
driver.get(orderUrl);
System.out.println(driver.getTitle());
driver.quit();
}
}
org.openqa.selenium.WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"15372.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=57.0.2987.110)
(Driver info: chromedriver=2.7.236900,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 184 milliseconds
Build info: version: '2.26.0', revision: '18041', time: '2012-11-01 19:33:38'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_20'
Driver info: driver.version: RemoteWebDriver
Session ID: 0db0541b1e8337218da90c01bd25804b
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:531)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:275)
at com.lvmama.test.Orders.OrdersPage(Orders.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
百度后知道这是由于Chrome和chromeDriver的不匹配造成的
然后就查Chrome和chromeDriver的对应关系:
可以在这里http://chromedriver.storage.googleapis.com/index.html,点击其中某个Chrome版本进入到下载页面(我选择的是2.30)
在下载页面有个notes.txt文件,点击这个文件就能看到这个ChromeDriver支持的Chrome版本了
然后下载下来的是一个压缩包,解压其中的.exe文件后,放到Chrome的安装目录下
我的安装目录是:C:\Program Files (x86)\Google\Chrome\Application
如果你是直接复制替换文件,可能会提醒文件被占用的什么东西,可能是刚才你跑selenium的时候没有写diriver.quit()
(哎,这坑我都能踩,也是醉了,所以说不管写多简单的case都要最后quit一下,别图省事),只需要打开任务管理器,结束chromedriver.exe就好
- selenium自动化测试资源整理(含所有版本chrome、chromedriver、firefox下载链接)
今天把手头有的一些关于selenium测试的资源整理了一下,分享出来. 1. 所有版本chrome下载 是不是很难找到老版本的chrome?博主收集了几个下载chrome老版本的网站,其中哪个下载的是 ...
- 【转】所有版本chrome、chromedriver、firefox下载链接
所有版本chrome.chromedriver.firefox下载链接 1. 所有版本chrome下载 是不是很难找到老版本的chrome?博主收集了几个下载chrome老版本的网站,其中哪个下载的是 ...
- 所有版本chrome、chromedriver、firefox下载链接
1. 所有版本chrome下载 是不是很难找到老版本的chrome?博主收集了几个下载chrome老版本的网站,其中哪个下载的是原版的就不得而知了. http://www.slimjet.com/ch ...
- Chrome与chromedriver.exe的版本对应
Chrome与chromedriver.exe的版本对应 分类专栏: pyhton3.7+selenium3 转:https://blog.csdn.net/weixin_44545954/art ...
- Python selenium web UI之Chrome 与 Chromedriver对应版本映射表及下载地址和配置(windows, Mac OS)
浏览器及驱动下载 进行web UI 自动化时,需要安装浏览器驱动webdriver,Chrome浏览器需要安装chromedriver.exe 驱动,Firefox需安装 geckodriver.ex ...
- 【Linux】【Selenium】安装Chrome和ChromeDriver的配置
转自:https://www.cnblogs.com/longronglang/p/8078898.html 1.安装chrome sudo apt-get install libxss1 libap ...
- 如何解决selenium打开chrome提示chromedriver.exe已停止工作
场景:启动Chrome,打开URL,提示“disconnected: unable to connect to renderer” 解决方法:chromedriver与chrome的对应关系表, 需要 ...
- ubuntu 安装chrome 和chromedriver
1. chromedriver 下载地址: https://npm.taobao.org/mirrors/chromedriver 在这里找到对应的驱动 2. 安装谷歌浏览器 2.1 安装依赖 ap ...
- python+ubuntu+selenium安装chrome和chromedriver
请确保selenium已经安装成功,没安装的可以pip install selenium 安装chrome 在终端输入 下载安装包 wget https://dl.google.com/linux/d ...
随机推荐
- maven项目部署到tomcat中没有classe文件的问题汇总
1.修改生成的class文件的位置
- python面向对象类的约束和设计的统一化规范
.封装 定义:将一些东西内容封存到一个地方,你还可以再取出, 类设置静态属性,设置一些方法 对象可以在其对象空间中封装一些属性 2.多态 定义:一个事物的多种形态 就想a可以是一个字符串,可以是一个列 ...
- kafka + spark Streaming + Tranquility Server发送数据到druid
花了很长时间尝试druid官网上说的Tranquility嵌入代码进行实时发送数据到druid,结果失败了,各种各样的原因造成了失败,现在还没有找到原因,在IDEA中可以跑起,放到线上就死活不行,有成 ...
- VSTO开发Excel 2013/2016工作簿项目
范例下载:(下载后直接双击扩展名为.vsto的文件,或者双击扩展名为.xlsx的工作簿,按提示操作) ExcelWorkbook_Everything.rar
- [LC] 129. Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number ...
- OpenCV Laplace 算子
#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #i ...
- android greendao的外部封装不太友好。
https://github.com/greenrobot/greenDAO 下载下官网的示例,有完整的封装版本,但自已封装是碰到很多问题. 因greenDao的Master和Session中很多方法 ...
- VS自身的单元测试方法DEMO
///用来修饰测试类 [TestClass()] public class Program { private TestContext testContextInstance; /// <sum ...
- SWUST OJ NBA Finals(0649)
NBA Finals(0649) Time limit(ms): 1000 Memory limit(kb): 65535 Submission: 404 Accepted: 128 Descri ...
- Chrome 调试 react-native 通过Network面板查看网络请求
参考 https://github.com/facebook/react-native/issues/934 三楼 真机或模拟器下 Debug JS Remotely, 会打开chrome,地址为ip ...