JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory error using GeckoDriver Firefox and Selenium

Viewed 10490

I am getting below error even though I had set the correct path for gecko driver.

Main:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.Test;

public class firstCase {
    @Test
    static void titleControl(){
        System.setProperty("webdriver.gecko.driver", "D:\\Program Exe's\\geckodriver-v0.26.0-win64\\geckodriver.exe");          // Wee need that as Intellij doesn't know where it looks for browser
        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.google.com");
        Assert.assertEquals(driver.getTitle(),"Google");
    }
}

Error:

1594880236960   mozrunner::runner   INFO    Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\yasin\\AppData\\Local\\Temp\\rust_mozprofiledXH35Y"
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
1594880239039   Marionette  INFO    Listening on port 49419
1594880239073   Marionette  WARN    TLS certificate errors will be ignored for this session
Tem 16, 2020 9:17:19 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
1 Answers

This error message...

JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.

...implies that there was a JavaScript error while GeckoDriver initiated/spawned a new Browsing Context i.e. Firefox browsing session.


When Selenium driven GeckoDriver initiates a Firefox browsing session there can be a couple of JavaScript related WARNINGS and ERRORS as a part of TRACE level logs during initialization. You can safely ignore those initialization errors till GeckoDriver is successfully able to initiate a Firefox Browsing session.


Conclusion

When the createSession is successful and W3C dialect is detected you can safely ignore the errors.

Related