I'm using Selenium-serenity for my integration test. By default selenium integrate FirefoxDriver for the WebDriver, but now what I'm trying to do is use PhantomJS. I could not find so far how to set the driver properly after being initialized.
So far what I did is override the getDriver() method of pageObject and return the phantomJs webDriver
private static WebDriver webDriver;
@Override
public WebDriver getDriver() {
if (webDriver == null) {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "/Users/pabloperezgarcia/Downloads/phantomjs");
webDriver = new PhantomJSDriver(caps);
setDriver(webDriver);
}
return webDriver;
}
But the problem is that every single action over webdriver is not propagate over the other pages because of course we are only returning the singleton webDriver, but not the super.getDriver().
My question is how can I set properly the webdriver on serenity to be share the state between multiple pages object, which are new instances.
With Firefox seems work perfectly.