6

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
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Asell
  • 303
  • 1
  • 3
  • 15
  • 1
    Can you please elaborate on the question? I'm not sure what your error is. In my case, the same shows up in the console but it works just fine – RushiSrinivas.K Jul 16 '20 at 07:13
  • Actually my test is passed too but when I see `JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.` I suspect about what is wrong. Does it a problem? – Asell Jul 16 '20 at 07:24
  • 1
    Yea this happens if JS is not enabled on your browser. Check [this](https://www.wikihow.com/Turn-On-Javascript-in-Mozilla-Firefox#:~:text=From%20the%20Tools%20menu%2C%20click,or%20Preferences%20(on%20Mac).&text=Click%20the%20Content%20tab.,your%20Firefox%20browser%20can%20display.&text=Click%20Enable%20JavaScript%20or%20Enable%20Java%20.) out. – RushiSrinivas.K Jul 16 '20 at 08:15
  • hmm, interesting I follow the instructions but mine is already enabled. – Asell Jul 16 '20 at 08:22
  • 1
    Have a look at [this](https://stackoverflow.com/questions/49506768/how-to-capture-javascript-errors-with-selenium-webdriver-using-java) – RushiSrinivas.K Jul 16 '20 at 08:56

1 Answers1

6

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.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352