在写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就好
 

chrome 和 chromeDriver的更多相关文章

  1. selenium自动化测试资源整理(含所有版本chrome、chromedriver、firefox下载链接)

    今天把手头有的一些关于selenium测试的资源整理了一下,分享出来. 1. 所有版本chrome下载 是不是很难找到老版本的chrome?博主收集了几个下载chrome老版本的网站,其中哪个下载的是 ...

  2. 【转】所有版本chrome、chromedriver、firefox下载链接

    所有版本chrome.chromedriver.firefox下载链接 1. 所有版本chrome下载 是不是很难找到老版本的chrome?博主收集了几个下载chrome老版本的网站,其中哪个下载的是 ...

  3. 所有版本chrome、chromedriver、firefox下载链接

    1. 所有版本chrome下载 是不是很难找到老版本的chrome?博主收集了几个下载chrome老版本的网站,其中哪个下载的是原版的就不得而知了. http://www.slimjet.com/ch ...

  4. Chrome与chromedriver.exe的版本对应

    Chrome与chromedriver.exe的版本对应 分类专栏: pyhton3.7+selenium3   转:https://blog.csdn.net/weixin_44545954/art ...

  5. Python selenium web UI之Chrome 与 Chromedriver对应版本映射表及下载地址和配置(windows, Mac OS)

    浏览器及驱动下载 进行web UI 自动化时,需要安装浏览器驱动webdriver,Chrome浏览器需要安装chromedriver.exe 驱动,Firefox需安装 geckodriver.ex ...

  6. 【Linux】【Selenium】安装Chrome和ChromeDriver的配置

    转自:https://www.cnblogs.com/longronglang/p/8078898.html 1.安装chrome sudo apt-get install libxss1 libap ...

  7. 如何解决selenium打开chrome提示chromedriver.exe已停止工作

    场景:启动Chrome,打开URL,提示“disconnected: unable to connect to renderer” 解决方法:chromedriver与chrome的对应关系表, 需要 ...

  8. ubuntu 安装chrome 和chromedriver

    1. chromedriver 下载地址:  https://npm.taobao.org/mirrors/chromedriver 在这里找到对应的驱动 2. 安装谷歌浏览器 2.1 安装依赖 ap ...

  9. python+ubuntu+selenium安装chrome和chromedriver

    请确保selenium已经安装成功,没安装的可以pip install selenium 安装chrome 在终端输入 下载安装包 wget https://dl.google.com/linux/d ...

随机推荐

  1. FastDFS安装部署

    博主本人平和谦逊,热爱学习,读者阅读过程中发现错误的地方,请帮忙指出,感激不尽 服务器信息: Storage:192.168.247.20 Traker:192.168.247.21 一.搭建环境准备 ...

  2. Angular开发者指南(六)作用域

    什么是作用域? 作用域是引用应用程序模型的对象. 它是表达式的执行上下文. 作用域以层次结构排列,模仿应用程序的DOM结构,它可以观察表达式和传播事件. 作用域的特征 Scope提供API($watc ...

  3. deeplearning.ai 序列模型 Week 1 RNN(Recurrent Neural Network)

    1. Notations 循环序列模型的输入和输出都是时间序列.$x^{(i)<t>}$表示第$i$个输入样本的第$t$个元素,$T_x^{(i)}$表示输入的第$i$个样本的元素个数:$ ...

  4. _Random和_RandomString的使用区别

    __Random 函数介绍 作用:生成随机数 使用格式:${__Random(5,30,myResult_Random)},其中 第一个参数5,表示希望生成的数字最小的值,必填 第二个参数30,表示希 ...

  5. Docker企业级镜像仓库harbor(vmware 中国团队)

    第一步:安装docker和docker-compose 第二步:下载harbor-offline-installer-v1.3.0.tgz 第三步:上传到/opt,并解压 第四步:修改harbor.c ...

  6. Mac-常用命令与快捷键

    阅读更多 1.1 brew 格式: brew install <software> brew uninstall <software> brew update <soft ...

  7. 吴裕雄--天生自然 R语言开发学习:回归

    #------------------------------------------------------------# # R in Action (2nd ed): Chapter 8 # # ...

  8. python有关汉字编码问题

    python分为:程序编码(python安装程序).文件编码. 查看程序编码方式:sys.getdefaultencoding() 查看文件编码方式:1.import  chardet  2. f = ...

  9. Chrome 调试 react-native 通过Network面板查看网络请求

    参考 https://github.com/facebook/react-native/issues/934 三楼 真机或模拟器下 Debug JS Remotely, 会打开chrome,地址为ip ...

  10. springboot 多数据源之错误 HikariPool-1 - jdbcUrl is required with driverClassName.

    数据源连接报错: 之前在1.5.7的版本的时候用该数据源配置没问题,看如下所示 springboot1.5.7配置多数据源: datasource.master.url=jdbc:mysql://lo ...