gpt4 book ai didi

java - Selenium 火狐网络驱动程序

转载 作者:行者123 更新时间:2023-12-01 07:34:07 25 4
gpt4 key购买 nike

我在 ubuntu 上的程序中使用以下内容:

this.mDriver = new FirefoxDriver();

然后

driver.get("http://test.com");

我收到一条错误消息,意思是我使用的 Firefox 版本是最新的,我需要使用旧版本。

我下载了 Firefox 并将其解压。将其添加到路径中。

我修改了代码如下:

WebDriver driver = new FirefoxDriver(new FirefoxBinary(new File("/opt/firefox16/firefox")), profile);

当我从终端执行/opt/firefox16/firefox 时,它会启动浏览器。

但是当我执行上面的 WebDriver 代码行时,它仍然没有调用 Firefox 浏览器。我没有收到任何错误消息。

请有人指导我如何在创建并执行 WebDriver 时启动 Firefox?

最佳答案

您遇到的问题是一个常见问题。新版本的 Firefox 通常无法与最新版本的 Selenium Firefox WebDriver 配合使用。

解决方案是使用 Firefox 和 Selenium Firefox WebDriver 的兼容版本

我推荐以下内容:

  • Selenium Firefox WebDriver 版本2.33.0
  • Firefox 版本 18.0.2

这种组合对我来说一直很有效。

您还可以在 Release Notes 中查看哪个版本的 Selenium Firefox WebDriver(理论上)与哪个版本的 Firefox 兼容。 .

关于java - Selenium 火狐网络驱动程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14520739/

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