How to reuse the same WebDriver in different applications using selenium

I am writing here to ask if init is possible WebDriver

WebDriver driver = new FirefoxDriver();

and use the same browser for many jar applications, therefore, in another jar file, something like:

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

I ask this question because FirefoxDriver is very slow to load and wait, and I need to call a lot of jar that load this driver. I think that thus, loading only once my driver, my general application will be faster than opening N-times N-instances of this driver. I hope my question is clear and well-formed :) thanks to everyone!

EDIT: I see that there is an opportunity to use RemoteWebDriver.

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

How can i use it? when do i need to instantiate webdriver in localhost: 4444?

+3
1

Selenium. , WebDriver . , RemoteWebDriver, - . .

, , - HUB, jars (classes), Firefox driver. , , , .

! , Firefox, FirefoxProfile. , , Firefox , .

+1

All Articles