Consoleのエラーについて

194 views
Skip to first unread message

Tottoro

unread,
Aug 2, 2020, 6:05:51 AM8/2/20
to 日本Seleniumユーザーコミュニティ
どなたかエラーの理由、そして、解決方法など教えていただけないでしょうか。

ソースコード
package newproject;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
//comment the above line and uncomment below line to use Chrome
//import org.openqa.selenium.chrome.ChromeDriver;
public class PG1 {


    public static void main(String[] args) {
        // declaration and instantiation of objects/variables
    	System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe");
		WebDriver driver = new FirefoxDriver();
		//comment the above 2 lines and uncomment below 2 lines to use Chrome
		//System.setProperty("webdriver.chrome.driver","G:\\chromedriver.exe");
		//WebDriver driver = new ChromeDriver();
    	
        String baseUrl = "http://demo.guru99.com/test/newtours/";
        String expectedTitle = "Welcome: Mercury Tours";
        String actualTitle = "";

        // launch Fire fox 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 with 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 Fire fox
        driver.close();
       
    }

}

Consoleのエラー
Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\geckodriver.exe
at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:146)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:141)
at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:44)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:167)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:355)
at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:190)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at newproject.NewClass.main(NewClass.java:12)

こちらのサイトを参考に、環境構築し、Seleniumを勉強しております。

よろしくお願いいたします。

藤田光

unread,
Aug 2, 2020, 7:09:18 AM8/2/20
to 日本Seleniumユーザーコミュニティ
エラーメッセージの先頭に
「The driver executable does not exist: C:\geckodriver.exe」
とあります。

setPropertyで設定されている各パラメータは正しいですか?
もしくは設定しているパラメータにあった環境を構築できていますか?
⬇︎を参考に、再度ご確認されて見てはいかがでしょうか。

https://www.selenium.dev/documentation/ja/webdriver/driver_requirements/

Tottoro

unread,
Aug 2, 2020, 9:05:57 PM8/2/20
to 日本Seleniumユーザーコミュニティ

ご指摘ありがとうございます。
setPropertyで設定されている各パラメータが正しくありませんでした、ありがとうございます。
しかし、また次のようなエラーが発生しました。

1596416222242 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\niwaki\\AppData\\Local\\Temp\\rust_mozprofilelf5qAd"
console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
1596416226042 Marionette INFO Listening on port 56600
1596416226083 Marionette WARN TLS certificate errors will be ignored for this session
8月 03, 2020 9:57:06 午前 org.openqa.selenium.remote.ProtocolHandshake createSession
情報: Detected dialect: W3C
Test Passed!
1596416232682 Marionette INFO Stopped listening on port 56600
IPDL protocol error: Handler returned error code!

###!!! [Parent][DispatchAsyncMessage] Error: PLayerTransaction::Msg_ReleaseLayer Processing error: message was deserialized, but the handler returned false (indicating failure)


###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost


###!!! [Child][MessageChannel::SendAndWait] Error: Channel error: cannot send/recv


エラーとその対処方法など記載されているサイトなどご存じであれば、ご教示いただけないでしょうか。

よろしくお願いいたします。



2020年8月2日日曜日 20時09分18秒 UTC+9 藤田光:
Reply all
Reply to author
Forward
0 new messages