过去几个小时我一直在为此而苦苦挣扎。我正在尝试安装Selenium Web驱动程序,并且遇到了一些阻止我运行测试页的错误。我很确定我最近的问题是这个代码:驱动程序可执行文件不存在:Selenium Firefox
public static void main(String[] args) throws InterruptedException{
System.setProperty("webdriver.gecko.driver","C:/Users/theone/Downloads/geckodriver 2.exe");
真的很感激任何反馈的第二步!
package automationFramework;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FirstTestCase {
public static void main(String[] args) throws InterruptedException{
System.setProperty("webdriver.gecko.driver","C:/Users/theone/Downloads/geckodriver 2.exe");
// Create a new instance of the Firefox driver
WebDriver driver = new FirefoxDriver();
//Launch the Online Store Website
driver.get("http://www.store.demoqa.com");
// Print a Log In message to the screen
System.out.println("Successfully opened the website www.Store.Demoqa.com");
//Wait for 5 Sec
Thread.sleep(5);
// Close the driver
driver.quit();
}
}
谢谢!有效! –
@RanaHaram - 如果这个答案能解决你的问题,那么请接受它作为正确答案 – bakoyaro