English 中文(简体)
如何在不同的应用中使用 在不同的应用程序中重新使用相同的 WebDriver
原标题:How to reuse the same WebDriver in different application using selenium

i 在这里写入, 以询问是否可插入 webDriver < 。

WebDriver driver = new FirefoxDriver();

并使用相同的浏览器用于许多 jar 应用程序, 因此在其他 jar 文件中, 比如 :

int port = ...;
String host = ...;
WebDriver driver = getDriver(host,port);

我之所以问这个问题,是因为FirefoxDriver的载货速度和出现速度非常慢, 我需要调用许多载货司机的罐子。 我认为这样,只要装上一次我的司机, 我的全部应用程序将比开N-times N-Instances的司机快。 我希望我的问题清晰明了, 多亏了大家!

EDIT: i see that there is the possibility to use RemoteWebDriver.

DesiredCapabilities capability = DesiredCapabilities.firefox();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);

我怎么能用它呢?当我不得不在本地主机44444中 即时将网络驱动器转接时?

问题回答

这是< a href=> http://code.google.com/p/selenium/issues/ detail?id=18' rel=18" rel="nofollow" 中最需要的功能请求。 但是, 仍然无法在运行浏览器窗口时附加 < code> WebDriver 。 您在 < code> remoteWebDriver 中发现的是, 在另一台计算机上远程运行测试的可能性。 但是该计算机仍然必须启动一个新的浏览器窗口 。

我想,你可以写下你的应用程序,把它写成一个HUB, 将所有罐子(类)排入运行中, 开始一个火狐案例, 并绕过 < code> driver 引用。 这不是一个不错的解决方案, 据我所知, 目前还没有人这样做 。

但在 Firefox 启动时花费的大部分时间都在创建一个新的 < a href=" http://selenium.googlecode.com/svn/trunk/docs/ api/java/ org/ openqa/ selenium/firefox/ FirefoxProfile.html" rel="nofollow"\\code> FirefoxProfiles 。 如果您创建一个用于测试的配置文件, 并用此配置来启动您的 Firefox, 将会大大加快速度 。





相关问题
Javascript communication with Selenium (RC)

My Application has a lot of calculation being done in JavaScript according to how and when the user acts on the application. The project prints out valuable information (through console calls) as to ...

Running automated Web browser tests under Hudson

I m running Hudson for my automated builds and love it. I d now like to create automated Web browser tests using either WaTiN (preferred) or Selenium. As my Hudson runs as a Windows service (under ...

Using a Java library with Scala reserved words

I m using an external library written in Java (Selenium). One of the function calls has the signature type(String, String), and I keep getting compiler errors when trying to call it from Scala, that ...

Heightened privilege selenium browsers on Windows 7 (x64)

I make use of *firefox and *iexplore etc. within my selenium tests to get around the issue of self-signed SSL certificates on my local machine. Unfortunately, now that I ve moved from XP over to 7, ...

Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Selenium IDE: Incrementing values by 1 and 71

Currently I m incrementing a value called wert by 1 with the following code: getEval storedVars[ wert ]=${wert}+1; The value wert is something like 80401299. I want to add 1 to the value, if it ...

热门标签