過去幾個小時我一直在爲此而苦苦掙扎。我正在嘗試安裝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