【问题标题】:org.openqa.selenium.SessionNotCreatedException Failed to start browser \\?\C:\Program Files\Mozilla Firefox\firefox.exe: other os errororg.openqa.selenium.SessionNotCreatedException 无法启动浏览器 \\?\C:\Program Files\Mozilla Firefox\firefox.exe: other os error
【发布时间】:2017-06-01 08:27:56
【问题描述】:

我正在尝试使用以下代码启动 Firefox 浏览器;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

public class test00104 {

    @Test

    public void testerror15() throws InterruptedException{
        System.setProperty("webdriver.gecko.driver","D:\\WorkSpace_Shweta\\UIAutomation\\lib\\geckodriver.exe");
        //System.setProperty("webdriver.firefox.bin","C:\\Program Files\\Mozilla Firefox\\firefox.exe");
        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.google.com");
        Thread.sleep(2000);
        driver.findElement(By.xpath("http://www.google.com")).sendKeys("Selenium hq");
    }
}

不知何故它不起作用,我得到的错误是:

org.openqa.selenium.SessionNotCreatedException Failed to start browser \\?\C:\Program Files\Mozilla Firefox\firefox.exe: other os error.

我看到了几个帖子,但没有找到答案。 使用环境:Selenium 3.4.0、Gecko 0.16.0 和 FF 53.0.3

【问题讨论】:

    标签: selenium-firefoxdriver geckodriver


    【解决方案1】:

    我遇到了类似的问题,这是由于超出了 /tmp 的配额导致 geckodriver 无法在那里创建 Rust 配置文件目录 (rust_mozprofile*)。

    您可以使用TEMP 环境变量为这些配置文件指定不同的位置(请参阅https://github.com/mozilla/geckodriver/issues/299)。另外,请确保使用driver.quit() 正确关闭驱动程序,以防止配置文件填满您的TEMP

    【讨论】:

      猜你喜欢
      • 2020-04-29
      • 2012-02-10
      • 2019-09-06
      • 2013-03-02
      • 2017-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多