gpt4 book ai didi

java - 用于 Selenium WebDriver 的 PhantomJS 2.5.0-beta 在 Linux 中不工作

转载 作者:太空狗 更新时间:2023-10-29 12:25:39 27 4
gpt4 key购买 nike

我在测试中使用 Linux 版本 2.5.0-beta 的 PhantomJS 二进制文件用于 Selenium WebDriver(可用 here),但它不工作。例如,此测试用例在 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
}

}

我得到的错误跟踪如下:

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)

此时这是二进制错误吗?

更新

我安装了以下依赖:

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

最佳答案

您是否安装了所有必需的依赖项?

来自 2.5 测试版 announcement :

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

关于java - 用于 Selenium WebDriver 的 PhantomJS 2.5.0-beta 在 Linux 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41675982/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com