Skip to content

Instantly share code, notes, and snippets.

@compwron
Forked from rameshbaskar/PhantomJS.java
Created December 29, 2016 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save compwron/ed45c64c61688e11b57bdd545b35bc76 to your computer and use it in GitHub Desktop.
Save compwron/ed45c64c61688e11b57bdd545b35bc76 to your computer and use it in GitHub Desktop.
Replacing Firefox driver to PhantomJS driver
// Current Implementation - Using FirefoxDriver
@Before
public static void before() {
driver = new FirefoxDriver();
admin = new AdminApi();
user = new UserApi(driver);
screen = new ScreenApi(driver);
}
// New Implementation - Using PhantomJSDriver
@Before
public static void before() {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
caps.setCapability("takesScreenshot", true);
driver = new PhantomJSDriver(caps);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment