2017-01-16 36 views
2

我在測試中使用PhantomJS二進制文件的Linux版本2.5.0-beta for Selenium WebDriver(可用here),但它不起作用。例如,這個測試用例上安裝失敗在Ubuntu 16.04:PhantomJS 2.5.0-beta for Selenium WebDriver不能在Linux中工作

public class PhantomJsTest { 

    protected WebDriver driver; 

    @BeforeClass 
    public static void setupClass() { 
     System.setProperty("phantomjs.binary.path", 
       "/path/to/linux-ubuntu-trusty-x86_64/2.5.0/phantomjs"); 
    } 

    @Before 
    public void setupTest() { 
     driver = new PhantomJSDriver(); 
    } 

    @After 
    public void teardown() { 
     if (driver != null) { 
      driver.quit(); 
     } 
    } 

    @Test 
    public void test() { 
     // my test 
    } 

} 

的錯誤跟蹤我得到的是以下幾點:

Jan 16, 2017 12:50:52 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> 
INFO: executable: /home/boni/.m2/repository/webdriver/phantomjs/linux-ubuntu-trusty-x86_64/2.5.0/phantomjs 
Jan 16, 2017 12:50:52 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> 
INFO: port: 14863 
Jan 16, 2017 12:50:52 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> 
INFO: arguments: [--webdriver=14863, --webdriver-logfile=/home/boni/Documents/dev/other/webdrivermanager/phantomjsdriver.log] 
Jan 16, 2017 12:50:52 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> 
INFO: environment: {} 
/home/boni/.m2/repository/webdriver/phantomjs/linux-ubuntu-trusty-x86_64/2.5.0/phantomjs: error while loading shared libraries: libicui18n.so.52: cannot open shared object file: No such file or directory 
Jan 16, 2017 12:51:13 PM org.openqa.selenium.os.UnixProcess checkForError 
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127) 

是在這個時刻這個二進制越野車?

UPDATE

我安裝了以下的依賴:

sudo apt-get install libicu-dev 

...現在我得到這個錯誤:

INFO: Detected dialect: OSS 
PhantomJS has crashed. Please read the bug reporting guide at 
<http://phantomjs.org/bug-reporting.html> and file a bug report. 
Jan 16, 2017 2:39:35 PM org.apache.http.impl.execchain.RetryExec execute 
INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {}->http://localhost:11591: The target server failed to respond 
Jan 16, 2017 2:39:35 PM org.apache.http.impl.execchain.RetryExec execute 
INFO: Retrying request to {}->http://localhost:11591 

回答

1

有你安裝了所有必要的依賴?

從2.5 beta測試版announcement

For Ubuntu binaries you need to install some dependencies:
png
jpeg webp
openssl
zlib
fontconfig and freetype
libicu

+0

我沒有,但我現在就是這麼做: 命令和apt-get安裝libicu-dev的 現在我得到另一個錯誤,現在看來很清楚,是一個bug: 信息:檢測到的方言:OSS PhantomJS已經崩潰。請閱讀 上的錯誤報告指南並提交錯誤報告。 2017年1月16日下午1:46:01 org.apache.http.impl.execchain.RetryExec執行 –

+0

如何在Linux中使用它。 –

+0

@SantoshHegde下載linux版本,解壓並運行它。或者你的意思是別的嗎? – Vaviloff

相關問題