How ChromeDriverService is useful in selenium automation

119 views
Skip to first unread message

Tester87

unread,
Dec 3, 2013, 11:58:40 PM12/3/13
to seleniu...@googlegroups.com
Hi,

We have ChromeDriverService class available in org.openqa.selenium.chrome ...

I understand this will help in starting the chrome driver on any port of the machine with the below code...

ChromeDriverService src = new ChromeDriverService.Builder().usingDriverExecutable(new File("Location of chromedriver.executable")).usingAnyFreePort().build();
src.start();

But not sure of how this is helpful for us in the automation, in which scenario this can be used ...

If we want to start the chrome browser with RemoteWebDriver having the DesiredCapability with Chrome, then we need to start running the selenium server standalone... the above ChromeDriverService is not useful there..

Please throw some light on ChromeDriverService


Andreas Tolfsen

unread,
Dec 4, 2013, 6:30:42 AM12/4/13
to seleniu...@googlegroups.com

musaf...@accolite.com writes:

> Hi,

Hi there!

> We have *ChromeDriverService* class available in
> org.openqa.selenium.chrome...
>
> I understand this will help in starting the chrome driver on any port
> of the machine with the below code...

[…]

> But not sure of how this is helpful for us in the automation, in which
> scenario this can be used ...
>
> If we want to start the chrome browser with RemoteWebDriver having the
> DesiredCapability with Chrome, then we need to start running the selenium
> server standalone... the above ChromeDriverService is not useful there..
>
> Please throw some light on ChromeDriverService

The ChromeDriverService class is primarily used as a backend to the
ChromeDriver class you'd normally use when initializing a driver
instance. It manages the lifespan of the chromedriver executable
provided by Google, that translates the webdriver command set into
Chrome's remote debugger protocol.

If you for some reason would want to have a chromedriver instance living
beyond the lifespan of a WebDriver instance, you could use this class as
you showed above. Normally this class won't be used directly, but since
it extends DriverService it gives you the option to offer a replacement
driver backend to the ChromeDriver class.

I hope that helps to shed some light on the matter.
Reply all
Reply to author
Forward
0 new messages