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)