2016-07-26 13 views
0

Ich versuche, laden Phantom js wie unten.Wie konfiguriert man Phantomjs Treiber in Linux-Rechner mit Java?

File file = new File("src/test/resources/phantomjs-linux");    
System.setProperty("phantomjs.binary.path", file.getAbsolutePath());  

Wenn ich ausführen diese in Linux-Maschine wird unter Ausnahme:

java.lang.IllegalStateException: The driver is not executable: /home/tomcat-jenkins/workspace/pitchIT/pitchIT-services/src/test/resources/phantomjs-linux 
    at com.google.common.base.Preconditions.checkState(Preconditions.java:199) 
    at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:121) 
    at org.openqa.selenium.phantomjs.PhantomJSDriverService.findPhantomJS(PhantomJSDriverService.java:246) 
    at org.openqa.selenium.phantomjs.PhantomJSDriverService.createDefaultService(PhantomJSDriverService.java:182) 
    at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:99) 
    at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:89) 
    at com.astrazeneca.als.pitchIT.util.BDDUtilities.doInit(BDDUtilities.java:69) 
    at com.astrazeneca.als.pitchIT.util.BDDUtilities.getDriver(BDDUtilities.java:33) 
    at com.astrazeneca.als.pitchIT.controller.PitchITHomepageSteps.an_browser_win 

Antwort

0

aber wenn Sie es mit absolutem Pfad

Datei phantomJSBinary = new File ("Pfad" haben + Datei .separator + "to" + Datei.separator + "phantomjs"); DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability (PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomJSBinary.getAbsolutePath());