Skip to content

anthavio/phanbedder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phanbedder Cloudbees DEV@cloud

Maven Central Coverage Status

Jenkins Jenkins Build Status Drone CI Drone CI Status Codeship Codeship Status Travis CI Build Status

PhantomJS Windows/Linux/MacOSX native binary embedder

Tired of java.lang.IllegalStateException: The path to the driver executable must be set by the phantomjs.binary.path capability/system property/PATH variable; for more information, see https://github.com/ariya/phantomjs/wiki. The latest version can be downloaded from http://phantomjs.org/download.html when creating PhantomJSDriver instance?

This library bundles PhantomJS binaries and unpacks right one for you on any of supported platforms - Linux, Windows and Mac OS X.

Simply with Ghost Driver

	//Phanbedder to the rescue!
		File phantomjs = Phanbedder.unpack();
		DesiredCapabilities dcaps = new DesiredCapabilities();
		dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjs.getAbsolutePath());
		PhantomJSDriver driver = new PhantomJSDriver(dcaps);
	//Usual Selenium stuff...
		driver.get("https://www.google.com");
		WebElement query = driver.findElement(By.name("q"));
		query.sendKeys("Phanbedder");
		query.submit();

		Assertions.assertThat(driver.getTitle()).contains("Phanbedder - Google Search");
		driver.quit();

Add maven dependency or download jar. Number 2.1.1 stands for PhantomJS version bundled inside.

    <dependency>
      <groupId>net.anthavio</groupId>
      <artifactId>phanbedder-2.1.1</artifactId>
      <version>1.0.0</version>
    </dependency>
    
    <dependency>
      <groupId>com.github.detro.ghostdriver</groupId>
      <artifactId>phantomjsdriver</artifactId>
      <version>1.1.0</version>
    </dependency>

Previous stable version is 1.9.8

    <dependency>
      <groupId>net.anthavio</groupId>
      <artifactId>phanbedder-1.9.8</artifactId>
      <version>1.0.0</version>
    </dependency>
    
    <dependency>
      <groupId>com.github.detro.ghostdriver</groupId>
      <artifactId>phantomjsdriver</artifactId>
      <version>1.1.0</version>
    </dependency>