WebDriver使用IE和chrome浏览器
因为我用的是 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也出现一样的问题,看来得换个思路,不能靠换浏览器了。
A[%7BT()W%7B1.png)

WebDriver使用IE和chrome浏览器的更多相关文章
- webdriver高级应用- 禁止Chrome浏览器的PDF和Flash插件
#encoding=utf-8 from selenium import webdriver # 导入Options类 from selenium.webdriver.chrome.options i ...
- webdriver高级应用- 使用Chrome浏览器自动将文件下载到指定路径
#encoding=utf-8 from selenium import webdriver import unittest, time class TestDemo(unittest.TestCas ...
- atitit.浏览器web gui操作类库 和 操作chrome浏览器的类库使用总结
atitit.浏览器web gui操作类库 和 操作chrome浏览器的类库使用总结 1. 常见标准 1 1.1. 录制重放 1 1.2. 一个窗体一个proxy cookie 1 1.3. exec ...
- 爬虫动态渲染页面爬取之selenium驱动chrome浏览器的使用
Selenium是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样,可以用其进行网页动态渲染页面的爬取. 支持的浏览器包括IE(7, 8, 9, 10 ...
- selenium webdriver启动Chrome浏览器后无法输入网址的解决办法
通过selenium webdriver启动Chrome浏览器,脚本如下: from selenium import webdriver browser = webdriver.Chrome() br ...
- selenium webdriver 使用Chrome 浏览器
首先需要有ChromeDriver驱动来协助.ChromeDriver是实现WebDriver有线协议的一个单独的服务.ChromeDriver通过chrome的自动代理框架控制浏览器,ChromeD ...
- 【Selenium专题】WebDriver启动Chrome浏览器(二)
官方API Constructor Summary ChromeDriver() Creates a new ChromeDriver using the default server configu ...
- 【Selenium专题】WebDriver启动Chrome浏览器(一)
selenium操作chrome浏览器需要有ChromeDriver驱动来协助.一.什么是ChromeDriver?ChromeDriver是Chromium team开发维护的,它是实现WebDri ...
- Python3 + selenium + Chrome浏览器(webdriver.Chrome()报错)
Python3 + selenium + Chrome浏览器 Error: selenium.common.exceptions.WebDriverException: Message: 'chrom ...
随机推荐
- angular中的等号(==)判定
使用angularjs的时候会使用到其中的表达式,其中有相等的判断.由于js有==和===的区别,于是就想看看是否相同.自己稍微做了一点测试,一看便知. 先给结论:angularjs表达式中的==和= ...
- The Skyline Problem leetcode 详解
class Solution { public: vector<pair<int, int>> getSkyline(vector<vector<int>&g ...
- 表格单元格td设置宽度无效的解决办法 .
http://zzstudy.offcn.com/archives/11366 在做table页面时,有时对td设置的宽度是无效的,td的宽度始终有内部的内容撑开,可以设置padding,但直接设置w ...
- css display属性介绍
none此元素不会被显示. block此元素将显示为块级元素,此元素前后会带有换行符. inline默认.此元素会被显示为内联元素,元素前后没有换行符. inline-block行内块元素.(CSS2 ...
- linux下文件搜索
常用: grep -nr "关键字" 搜索当前目录下所有匹配关键字的文件 grep -nr "关键字" *php 搜索当前目录下所有匹配关键字的php文件 f ...
- C#的GridView控件复习
一,在新建一个空网站 二,在这网站新建一个default.aspx页面 三,添加一个GridView控件 四,新建一个数据库,这个数据库包含你要显示的表数据,这个表须包含主键(表的主键影响增删改的功能 ...
- iOS开发设置关于tabBar和navigationBar以及item中的一些全局属性
/* To set item label text attributes use the appearance selectors available on the superclass, UIBar ...
- jQuery复习:第四章
一.jQuery中的事件 1.加载DOM $(document).ready()和window.onload方法具有类似功能,但是执行时机不同.window.onload方法是在网页中所有的元素都加载 ...
- webpack-hot-middleware 用于 livereload
https://github.com/glenjamin/webpack-hot-middleware Webpack hot reloading using only webpack-dev-mid ...
- OpenCL( 一)
#include <CL/cl.h> #include <iostream> #include <string> #include <fstream> ...