无法启动Firefox浏览器71.0.xxxx

时间:2019-12-19 22:58:08

标签: selenium firefox browser

我试图在Windows 10中启动firefox浏览器71.0.XXXX(64位)。在testng.xml文件中传递浏览器类型的ass参数。但是它给我错误。我已经下载了geckodriver-v0.26.0-win64.zip 来自https://github.com/mozilla/geckodriver/releases的最新版本的geckodriver。 请帮忙 以下是我的代码段。

    private void setDriver(String browserType, String appURL) {
    switch (browserType) {
    case "firefox":
    driver = initFirefoxDriver(appURL);
    break;
    case "chrome":
    driver = initChromeDriver(appURL);
    break;
    case "IE":
    driver = initIEDriver(appURL);
    break;
    case "edge":
    driver = initEdgeDriver(appURL);
    break;
    default:
    System.out.println("browser : " + browserType+ " is invalid, Launching  browser of choice..");
    driver = initFirefoxDriver(appURL);
    }
    }
    private static WebDriver initFirefoxDriver(String appURL) {
    System.setProperty("webdriver.gecko.driver", driverPath
                + "geckodriver.exe");
        WebDriver driver = new FirefoxDriver();
        driver.manage().window().maximize();
        driver.navigate().to(appURL);
        return driver;
    }
    @Parameters({ "browserType", "appURL" })
    @BeforeClass
    public void initializeTestBaseSetup(String browserType, String appURL) {
    try {
    setDriver(browserType, appURL);
    } catch (Exception e) {
    System.out.println(browserType+"...");
    System.out.println("Error....." + e.getStackTrace());
    }
    }

错误消息为 [Ljava.lang.StackTraceElement; @ 1621da3a 。我能够成功启动Chrome浏览器。

0 个答案:

没有答案