JavaScript error: undefined, line 492: Component returned failure code:

I am new to selenium, and getting this below error.

Selenium 3.4.0 Firefox browser 47.0.2 geckodriver-v0.16.1-win64

Please help on this, Thanks in advance. :)

Below is the test code:

System.setProperty("webdriver.gecko.driver","C:\\Users\\User\\Downloads\\geckodriver-v0.16.1-win64\\geckodriver.exe");

    /*   DesiredCapabilities capabilities = DesiredCapabilities.firefox();
       capabilities.setCapability("marionette", false); // true getting : AddonManager is not initialized
       WebDriver driver = new FirefoxDriver(capabilities); */

    driver = new FirefoxDriver();
    vURL = "http://www.facebook.com";
    driver.navigate().to(vURL);

    driver.findElement(By.xpath("//*[@id='day']")).sendKeys("9");
    driver.quit();

Error:

JavaScript error: undefined, line 492: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getCharPref] JavaScript error: resource://gre/modules/AddonManager.jsm, line 2484: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized Oct 11, 2017 3:43:19 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C

1 answer

  • answered 2017-10-11 10:23 iamsankalp89

    You are commented the code

    WebDriver driver = new FirefoxDriver(capabilities); 
    

    then how driver is instantiate

    use this it is working

        System.setProperty("webdriver.gecko.driver","E:\\geckodriver.exe");
        WebDriver driver=new FirefoxDriver(); 
        String vURL = "http://www.facebook.com";
        driver.navigate().to(vURL);
    
        driver.findElement(By.xpath("//*[@id='day']")).sendKeys("9");
        driver.quit();