如何在Selenium WebDriver中使用不同版本的IE(IE6,7,8,9和10) [英] How to use different version of IE (IE6, 7, 8, 9 and 10) in Selenium WebDriver with Java

查看:971
本文介绍了如何在Selenium WebDriver中使用不同版本的IE(IE6,7,8,9和10)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从以下网址下载了IEDriverServer_Win32_2.28.0.zip:
http://code.google.com/p/selenium/downloads/detail?name=IEDriverServer_Win32_2.28.0.zip&can=2&q=

I have downloaded "IEDriverServer_Win32_2.28.0.zip" from the following URL: http://code.google.com/p/selenium/downloads/detail?name=IEDriverServer_Win32_2.28.0.zip&can=2&q=

在文件夹中提取zip文件后,我在WebDriver Java代码中使用了该路径,如下所示:

After extracting zip file in a folder, I have used that path in my WebDriver Java code as below:

File file = new File("E:\\Global Blue\\globalblue-selenium-test\\gb-selenium-test\\lib\\IEDriverServer_Win32_2.28.0\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
driver = new InternetExplorerDriver();

测试正在Internet Explorer中运行。
如何在Selenium WebDriver测试中使用不同版本的IE(IE6,7,8,9和10)?

The tests are running in Internet Explorer well. How can I use different version of IE (IE6, 7, 8, 9 and 10) in my Selenium WebDriver test?

推荐答案

IE驱动程序将使用机器上安装的任何版本的IE。在同一操作系统安装中,不支持运行多个版本的IE的方法。虽然有解决方案声称这样做,但他们在某种程度上都是缺乏的。即使使用不同的文档模式也不完美,IE驱动程序无法以编程方式设置文档模式。

The IE driver will use whatever version of IE is installed on the machine. There is no supported way to run multiple versions of IE on the same operating system installation. While there are solutions that claim to do so, they are all lacking in some way. Even using different document modes are not perfect, and there is no way in the IE driver to programmatically set the document mode.

运行不同版本的IE的方法IE驱动程序是为每个要运行的版本的IE使用不同的Windows安装。虚拟机是一个很好的方法。

The way to run different versions of IE with the IE driver is to use a different Windows installation for each version of IE you want to run against. Virtual machines are a wonderful approach to this.

这篇关于如何在Selenium WebDriver中使用不同版本的IE(IE6,7,8,9和10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆