坚持在多个浏览器中同时运行Selenium RC脚本

时间:2023-01-18 20:10:14

I am working in selenium RC with Java+Junit+Eclipse. For my project I have developed script which will run in only one browser i.e Firefox through the below code..

我正在使用Java + Junit + Eclipse在selenium RC中工作。对于我的项目,我已经开发了脚本,它将只在一个浏览器中运行,即Firefox通过以下代码运行。

public void setUp() throws Exception 
{
   selenium = new DefaultSelenium("localhost", 4444,"*firefox","http://www.google.com");
   FinalTestSuite.selenium.start();
   selenium.windowFocus();
   selenium.windowMaximize();
}

Now I am stuck because requirement came to run the script simultaneously in multiple browsers. I didn't find any helpful article.. Please anyone working on this same scenario...HELP! :)

现在我卡住了,因为需要在多个浏览器中同时运行脚本。我没有找到任何有用的文章..请在这个相同场景下工作的任何人...帮助! :)

3 个解决方案

#1


0  

You can use Selenium Grid to run a script in multiple browsers. Also you can refer this blog regarding its setup configuration.

您可以使用Selenium Grid在多个浏览器中运行脚本。您也可以参考此博客了解其设置配置。

Hope this helps.

希望这可以帮助。

#2


0  

Create a runner which will run the suite containing setUp()
Pass the browser name by variable to setup.

创建一个运行包含setUp()的套件的运行器将浏览器名称按变量传递给setup。

You can run the code multiple times with multiple RC server started on different ports.

您可以在不同端口上启动多个RC服务器的情况下多次运行代码。

e.g. My projects runs through ant so i pass -Dargument=*firefox on command prompt then my test cases run on firefox browser also you can pass the port number and host ip.

例如我的项目通过ant运行,所以我在命令提示符下传递-Dargument = * firefox,然后我的测试用例在firefox浏览器上运行,你也可以传递端口号和主机ip。

Thanks

#3


0  

The best thing to use for parallel execution is TestNG. But since you are using Junit , the following link may help you in that.

用于并行执行的最佳方法是TestNG。但由于您使用的是Junit,以下链接可能会对您有所帮助。

http://blog.varunin.com/2011/07/running-selenium-tests-on-different.html

#1


0  

You can use Selenium Grid to run a script in multiple browsers. Also you can refer this blog regarding its setup configuration.

您可以使用Selenium Grid在多个浏览器中运行脚本。您也可以参考此博客了解其设置配置。

Hope this helps.

希望这可以帮助。

#2


0  

Create a runner which will run the suite containing setUp()
Pass the browser name by variable to setup.

创建一个运行包含setUp()的套件的运行器将浏览器名称按变量传递给setup。

You can run the code multiple times with multiple RC server started on different ports.

您可以在不同端口上启动多个RC服务器的情况下多次运行代码。

e.g. My projects runs through ant so i pass -Dargument=*firefox on command prompt then my test cases run on firefox browser also you can pass the port number and host ip.

例如我的项目通过ant运行,所以我在命令提示符下传递-Dargument = * firefox,然后我的测试用例在firefox浏览器上运行,你也可以传递端口号和主机ip。

Thanks

#3


0  

The best thing to use for parallel execution is TestNG. But since you are using Junit , the following link may help you in that.

用于并行执行的最佳方法是TestNG。但由于您使用的是Junit,以下链接可能会对您有所帮助。

http://blog.varunin.com/2011/07/running-selenium-tests-on-different.html