gpt4 book ai didi

java - WebDriverException 无法识别的平台

转载 作者:行者123 更新时间:2023-12-01 20:12:24 26 4
gpt4 key购买 nike

我正在尝试将 PhantomJSDriver 与 Selenium 一起使用。

这是我的测试代码:

    public static void main(String[] args) {
// TODO code application logic here

DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
//caps.setCapability("takesScreenshot", true);
caps.setCapability(
PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
"C:\\Users\\Eligijus\\Documents\\NetBeansProjects\\CrawlerApp\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
);
WebDriver driver = new PhantomJSDriver(caps);

driver.get("http://en.wikipedia.org");

System.out.println("Page Title" +driver.getTitle());
}

}

这是控制台日志:

Exception in thread "main" org.openqa.selenium.WebDriverException: 
Unrecognized platform: windows-10-32bit
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-
27T16:15:26.402Z'
System info: host: 'DESKTOP-67KOQUP', ip: '192.168.1.25', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131'
Driver info: driver.version: PhantomJSDriver
at org.openqa.selenium.Platform.fromString(Platform.java:325)
at
org.openqa.selenium.remote.RemoteWebDriver
.startSession(RemoteWebDriver.java:23
4)
at org.openqa.selenium.remote.RemoteWebDriver.<init>
(RemoteWebDriver.java:140)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>
(PhantomJSDriver.java:116)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>
(PhantomJSDriver.java:105)
at crawlerapp.CrawlerApp.main(CrawlerApp.java:24)
C:\Users\Eligijus\AppData\Local\NetBeans\Cache\8.2\executor-
snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 2 seconds)

任何人都知道如何让它发挥作用。我在我的 Mac 上尝试了相同的操作,但遇到了相同的错误。

谢谢

最佳答案

遇到与上述相同的问题,您可能应该尝试将 seleninum 的版本更改为 3.5.3 而不是 3.6.0

详细内容可以引用以下github问题 https://github.com/SeleniumHQ/selenium/issues/4781#issuecomment-333452945

关于java - WebDriverException 无法识别的平台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46506654/

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