0
のWindows 10に入力取得されていませんビットセレンwebdriverを、3- URLをFirefoxブラウザ
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);
}
}
エラー:
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}
あなたのセレンとFirefoxのバージョンはお互いに互換性がありません。古いバージョンのfirefoxに切り替えるか、セレン版を安定版(v2.52.0)にダウングレードしてみてください – metar
なぜこの行にコメントしていますか?System.setProperty( "webdriver.gecko.driver"、 "D:\\ Selenium \ \ geckodriver.exe ");'? –
geckodriverを使ってFirefoxを起動するには、[このリンクにある](http://stackoverflow.com/questions/38676719/fail-to-launch-mozilla-with-selenium/38676858#38676858)をご覧ください。 –