Windows-10 eingegeben zu werden BitSelen WebDriver 3- URL nicht in den Firefox Browser
package newpackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class MyClass {
public static void main(String[] args) {
// declaration and instantiation of objects/variables
System.setProperty "webdriver.firefox.marionette","D:\\Selenium\\geckodriver.exe");
//System.setProperty("webdriver.gecko.driver","D:\\Selenium\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
String baseUrl = "http://newtours.demoaut.com";
String expectedTitle = "Welcome: Mercury Tours";
String actualTitle = "";
// launch Firefox and direct it to the Base URL
driver.get(baseUrl);
// get the actual value of the title
actualTitle = driver.getTitle();
/*
* compare the actual title of the page witht the expected one and print
* the result as "Passed" or "Failed"
*/
if (actualTitle.contentEquals(expectedTitle)){
System.out.println("Test Passed!");
} else {
System.out.println("Test Failed");
}
//close Firefox
driver.close();
// exit the program explicitly
System.exit(0);
}
}
Fehler:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: les":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"1.5","maxVersion":"9.9"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":0,"seen":true}
sieht aus wie Ihre Selen und Firefox-Version sind nicht miteinander kompatibel. Versuche, zu einer älteren Version von Firefox zu wechseln oder deine Selen-Version auf eine stabile Version herunterzustufen (v2.52.0) – metar
Warum hast du diese Zeile 'System.setProperty ("webdriver.gecko.driver", "D: \\ Selenium \" kommentiert? \ geckodriver.exe ");'? –
Werfen Sie einen Blick [über diesen Link] (http://stackoverflow.com/questions/38676719/fail-to-launch-mozilla-with-selenium/38676858#38676858), um Firefox mit Geckodriver zu starten. –