公共类LaunchBrowser {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
System.setProperty("webdriver.gecko.driver", "/Users/spectra/Drivers/geckodriver");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(40,TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(90, TimeUnit.SECONDS);
driver.get("https://www.seleniumhq.org");
}
}
线程“ main”中的异常java.lang.Error:未解决的编译问题: WebDriver无法解析为一种类型 FirefoxDriver无法解析为类型
at com.simplilearn.day2.oops.LaunchBrowser.main(LaunchBrowser.java:16)
答案 0 :(得分:1)
setProperty应该是
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", "/Users/spectra/Drivers/geckodriver");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(40,TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(90, TimeUnit.SECONDS);
driver.get("https://www.seleniumhq.org");
}