Boni García
Boni García

Reputation: 4858

PhantomJS 2.5.0-beta for Selenium WebDriver not working in Linux

I am using the Linux version 2.5.0-beta of PhantomJS binary for Selenium WebDriver (available here) in my tests but it is not working. For example, this test case fails on setup in Ubuntu 16.04:

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
    }

}

The error trace I get is the following:

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)

Is this binary buggy at this moment?

UPDATE

I installed the following dependency:

sudo apt-get install libicu-dev

... and now I get this error:

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

Upvotes: 2

Views: 949

Answers (1)

Vaviloff
Vaviloff

Reputation: 16838

Have you installed all necessary dependencies?

From 2.5 beta announcement:

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

Upvotes: 1

Related Questions