因为我用的是 selenium-dotnet-2.47.0.zip

IEDriverServer_x64下载地址

https://code.google.com/p/selenium/downloads/list?can=1&q=&colspec=Filename+Summary+Uploaded+ReleaseDate+Size+DownloadCount

https://code.google.com/p/selenium/downloads/detail?name=IEDriverServer_x64_2.39.0.zip&can=1&q=

chromedriver下载地址

http://chromedriver.storage.googleapis.com/index.html?path=2.4/

https://code.google.com/p/chromedriver/downloads/list?can=1&q=

谷歌会出现unable to discover open pages,要将之放置在chrome 安装目录下 然后设置环境变量看看 本人略懒 不去测试了

IWebDriver driver = new ChromeDriver("J:\\vs2010_lin_projects\\chromedriver_win32_2.3");

--------------------------------

开始使用Selenium2之后就一直在用FireFox,因为文章上都说webdriver对firefox支持的最好,同时也很好上手,试了一下就可用了,也就没再用其他浏览器,不过最近遇到了一个问题,是我不得不考虑尝试一下其他浏览器,尤其是IE,下面就说说我的尝试过程。

开始,仍然像使用firefox一样new一个实例,IWebDriver driver = new InternetExplorerDriver(),这个绝对没问题,编码时没有提示和报错,因为这个类是webdriver类库中提供的,同时还包括其他各种浏览器的,但是一运行就报错,错误是“The IEDriverServer.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://selenium-release.storage.googleapis.com/index.html.”,这是提示我要下载IEDriverServer.exe,这好像不同于FireFox,我觉得FireFox如果找到合适的版本(我现在用的是10)好像不用安装任何插件,可以直接支持,于是我就在网上找了一个IEDriverServer.exe,开始不知道怎么用,以为像Selenium1中使用remote server一样要双击运行这个exe程序,可是不行,仍然报错,我就开始根据错误信息乱猜了,是不是要配置环境变量啊,网上还说这个exe文件要放在什么特定的路径下啊,最后试了一下IWebDriver driver = new InternetExplorerDriver(“IEDriverServer.exe的路径”),这样就好了,不报之前的错了,也无需双击运行,不过要注意这个路径只写路径就好,不要写带文件名。新的错误又出现了“Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (NoSuchDriver)”,还好,网上对这个错误有比较准确的解决方案,就是IE浏览器关闭保护模式,所有四种情况的保护模式都要关闭,照做之后就不报错了,其他的代码可以不动,直接运行即可,不过网上说IE执行起来很慢,我觉得也是。顺便说一下,本来想尝试一下IE的初衷并没有因此而得到解决,因为IE也出现一样的问题,看来得换个思路,不能靠换浏览器了。

WebDriver使用IE和chrome浏览器的更多相关文章

  1. webdriver高级应用- 禁止Chrome浏览器的PDF和Flash插件

    #encoding=utf-8 from selenium import webdriver # 导入Options类 from selenium.webdriver.chrome.options i ...

  2. webdriver高级应用- 使用Chrome浏览器自动将文件下载到指定路径

    #encoding=utf-8 from selenium import webdriver import unittest, time class TestDemo(unittest.TestCas ...

  3. atitit.浏览器web gui操作类库 和 操作chrome浏览器的类库使用总结

    atitit.浏览器web gui操作类库 和 操作chrome浏览器的类库使用总结 1. 常见标准 1 1.1. 录制重放 1 1.2. 一个窗体一个proxy cookie 1 1.3. exec ...

  4. 爬虫动态渲染页面爬取之selenium驱动chrome浏览器的使用

    Selenium是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样,可以用其进行网页动态渲染页面的爬取. 支持的浏览器包括IE(7, 8, 9, 10 ...

  5. selenium webdriver启动Chrome浏览器后无法输入网址的解决办法

    通过selenium webdriver启动Chrome浏览器,脚本如下: from selenium import webdriver browser = webdriver.Chrome() br ...

  6. selenium webdriver 使用Chrome 浏览器

    首先需要有ChromeDriver驱动来协助.ChromeDriver是实现WebDriver有线协议的一个单独的服务.ChromeDriver通过chrome的自动代理框架控制浏览器,ChromeD ...

  7. 【Selenium专题】WebDriver启动Chrome浏览器(二)

    官方API Constructor Summary ChromeDriver() Creates a new ChromeDriver using the default server configu ...

  8. 【Selenium专题】WebDriver启动Chrome浏览器(一)

    selenium操作chrome浏览器需要有ChromeDriver驱动来协助.一.什么是ChromeDriver?ChromeDriver是Chromium team开发维护的,它是实现WebDri ...

  9. Python3 + selenium + Chrome浏览器(webdriver.Chrome()报错)

    Python3 + selenium + Chrome浏览器 Error: selenium.common.exceptions.WebDriverException: Message: 'chrom ...

随机推荐

  1. Webdriver其他定位方式

    1.下拉框的定位 在遇到select下拉框的选择时,比如: <select id="nr" name="NR"> <option select ...

  2. php 分析

    php  code in D:\10\11\php test in D:\10\11\php\test issue 1: <html><head><title>标记 ...

  3. isset()和empty()的区别

    form表单的数据提交过来 如果用isset() if(isset($_GET)){ .....} '' '0' 0 返回 true 不够严谨 empty() '' '0' 0 显示返回false 比 ...

  4. ELK配置说明及个人理解

    ELK是开源的日志查询系统,由三个开源工具组成:Elasticsearch.Logstash和Kibana; Elasticsearch的功能主要用于进行日志数据的存储及查询. Logstash提供日 ...

  5. spring杂记

    AOP(Aspect-Oriented Programming,面向切面编程)是一种编程思想,并不是一种具体的实现,谈到实现一般有Filter和代理模式两种常见的使用方式.Java中常见的AOP技术有 ...

  6. php 关联数组

    <?php header("content-type:text/html;charset=utf8");$fruit = array(    'apple'=>&quo ...

  7. pip 安装 lxml等 出错 解决

    x86-gnu-gcc 出错 安装如下 sudo apt-get install libffi-dev sudo apt-get install libssl-dev sudo apt-get ins ...

  8. 【LeetCode】423. Reconstruct Original Digits from English

    Given a non-empty string containing an out-of-order English representation of digits 0-9, output the ...

  9. php基本(四)表单验证

    本文内容来自http://www.w3school.com.cn/php/php_form_url_email.asp PHP 表单验证 - 验证 E-mail 和 URL 本节展示如何验证名字.电邮 ...

  10. ggplot2 分面相关设置(facet)

    分面设置在ggplot2应该也是要经常用到的一项画图内容,在数据对比以及分类显示上有着极为重要的作用, 下面是两个经常要用到的分面函数. facet_wrap(facets, nrow = NULL, ...