我无法使用该代码打开Firefox浏览器。我已成功完成打开浏览器Chrome和IE的操作

时间:2019-12-27 08:54:04

标签: java eclipse selenium selenium-webdriver

Eclipse中的代码:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


public class Demo1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        //selenim code-
        //create driver object Firefox browser
        //we will strictly implement methods of webdriver
        //geckodriver.exe 
        System.setProperty("webdriver.gecko.driver", "C:\\Software Testing\\geckodriver.exe");
        WebDriver driver=new FirefoxDriver();
        driver.get("https://coinmarketcap.com");
        System.out.println(driver.getTitle());
    }

}

显示的错误:

at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at Demo1.main(Demo1.java:17)

0 个答案:

没有答案