【问题标题】:I am not able to open URL using driver.get("URL") in selenium web driver我无法在 selenium Web 驱动程序中使用 driver.get("URL") 打开 URL
【发布时间】:2016-12-24 09:22:32
【问题描述】:

我无法在使用 Firefox 49.0.1 版的 selenium Web 驱动程序中使用 driver.get("URL") 打开 URL。 我得到的错误是:

org.openqa.selenium.firefox.NotConnectedException:45000 毫秒后无法连接到端口 7055 上的主机 127.0.0.1。 Firefox 控制台输出

【问题讨论】:

  • 添加更多细节,您是否遇到任何错误?
  • 是的。我得到的 PFB 错误。 “org.openqa.selenium.firefox.NotConnectedException:45000 毫秒后无法连接到端口 7055 上的主机 127.0.0.1。Firefox 控制台输出”
  • 我认为您使用的是旧的 selenium jar 文件,请更新到最新的并使用 geckodriver 连接到 firefox

标签: java selenium selenium-webdriver automation webdriver


【解决方案1】:

你需要从this链接下载geckodriver.exe,没有gecko驱动你不能运行firefox 49.0。下载后解压缩并存储在您机器上的任何位置,然后按照此代码进行操作。为此,请使用 Selenium 版本 3.0.1。 如果您使用的是旧版本的 selenium,那么您必须使用

WebDriver driver = new MarionetteDriver(); 

代替

WebDriver driver = new FirefoxDriver();

从此链接下载壁虎驱动:https://github.com/mozilla/geckodriver/releases

System.setProperty("webdriver.gecko.driver","C:\\Selenium\\Firefox driver\\geckodriver.exe"); // you have to select you path of gecko driver where you placed it after download and unzip.
WebDriver driver = new FirefoxDriver();

driver.get("http://www.hotmail.com");

【讨论】:

  • 这让我惊醒了。它是否适用于 Mozilla 49.o 的更高版本。我也想知道为什么要使用 geckodriver.exe(对于超过 49 个版本的 mozilla)和 WebDriver driver = new MarionetteDriver();(对于旧的 selenium 版本)?
猜你喜欢
  • 2019-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-29
  • 1970-01-01
  • 1970-01-01
  • 2019-12-14
相关资源
最近更新 更多