使用Selenium在多个版本的浏览器上进行测试

发布于 2024-10-08 03:18:37 字数 291 浏览 0 评论 0原文

我想知道是否有人熟悉使用 selenium 测试不同的浏览器版本。我知道您可以指定要测试的浏览器(使用 *firefox 或 *iexplore),但是如果我安装了多个版本的 firefox 或 IE,并且我想要一个测试来启动特定的 Web 浏览器版本,这样一个测试将运行 IE7,该怎么办?另一个可能会针对 IE8 运行。

目前,我的测试将始终针对我安装的任何默认浏览器版本运行。我意识到如果我在多台机器上运行硒,每个盒子都可以有不同的浏览器版本,这将解决我的问题,但我想知道我所要求的(一台机器上的多个浏览器版本)是否可能。

谢谢。

I was wondering if anyone is familiar with testing different browser versions using selenium. I know that you can specify which browser to test (using *firefox or *iexplore) but what if I had multiple versions of firefox or IE installed and I wanted a test to launch a specific web browser version, such that one test would run IE7 and another might run against IE8.

Currently, my tests will always run against whatever default browser version I have installed. I realize if I had selenium running on multiple machines each one of those boxes could have a different browser version and that would solve my problem but I'd like to know if what I'm asking (multiple browser versions on one machine) is possible.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

未蓝澄海的烟 2024-10-15 03:18:37

事实上,一台机器上不可能有这么多不同版本的浏览器——你不可能同时拥有不同的 IE 版本。 IETester 是一个选项,但不如拥有不同版本的虚拟机IE和FF的。

无论如何,最好的方法是使用不同的机器——无论是真实的还是虚拟的

Actually you cannot have so much different versions of browsers on one machine - you cannot have different IE versions at the same time. IETester is an option, but is not as good as having virtual machines with different versions of IE and FF.

Anyway the best approach to this is to use different machines - either real or virtual

ヅ她的身影、若隐若现 2024-10-15 03:18:37

您可以传递一个附加参数,它是浏览器二进制文件的完整路径。但是,大多数浏览器对安装多个版本都很挑剔,许多浏览器甚至不允许安装。在这种情况下,您确实需要单独的机器来运行您需要的每个环境。 Selenium Grid 是一个很好的选择。我们用它在 IE6、IE7、IE8、FF 和 IE 中进行测试。现在就用 Chrome。每个测试都指定它想要什么环境,并将其映射回特定计算机上的启动器。

You can pass an additional argument that is the full path to the browser binary. But, most browsers are picky about having multiple versions installed, many don't even allow it. In that case, you really need separate machines running each environment that you need. Selenium Grid is an excellent option here. We use it to test in IE6, IE7, IE8, FF, & Chrome right now. Each test specifies what environment it wants and that gets mapped back to a launcher on a particular machine.

最佳男配角 2024-10-15 03:18:37

是的,可以在目标浏览器上运行测试:

我在测试中安装了 FF3.6 和 FF4.1,因为 FF4.1 中没有对 Selenium IDE 的良好支持,我想针对 FF3.6.17 运行测试。这是我所做的

:添加环境变量 DEFAULT_BROWSER 作为

  "*custom path/to/firefox 3.6/firefox.exe"

. $TESTS_SELENIUM_BROWSER= getenv('DEFAULT_BROWSER') ? ...

在 PHP 代码中

。编写测试类

class myTests extends  PHPUnit_Extensions_SeleniumTestCase{
 .... 
 protected function setUp()
    {       
        $this->setBrowser($TESTS_SELENIUM_BROWSER);
            ....
    } 

 }

希望这会有所帮助:)

Yes its possible to run tests on trageted browser :

I have FF3.6 and FF4.1 installed on my tests since there is no good support for Selenium IDE in FF4.1, I want to run test against FF3.6.17 . Here what I do :

. Add an environment variable DEFAULT_BROWSER as

  "*custom path/to/firefox 3.6/firefox.exe"

. $TESTS_SELENIUM_BROWSER= getenv('DEFAULT_BROWSER') ? ...

in php code

. write test class as

class myTests extends  PHPUnit_Extensions_SeleniumTestCase{
 .... 
 protected function setUp()
    {       
        $this->setBrowser($TESTS_SELENIUM_BROWSER);
            ....
    } 

 }

hope this will help :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文