NS_ERROR_NOT_INITIALIZED resembles an attempt which was made to use a component or object which has not yet been initialized. These components usually provide an initialization method, often called Init
which must be called before any other methods which are being used.
However, this error message...
[Exception... "Component not initialized" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: chrome://marionette/content/dom.js :: addEventListener :: line 67" data: no]
...implies that the Marionette threw an error while invoking addEventListener
as defined in dom.js
Your code trials and the relevant HTML DOM would have helped us to debug the issue in a better way. However it seems the addEventListener
was invoked too early even before the DOM Tree was completely rendered. To be more specific addEventListener
was invoked even before the Browser Client (i.e. the Web Browser) have attained 'document.readyState'
equal to "complete"
. Generally once this condition is fulfilled Selenium performs the next line of code.
Solution
A quick solution will be to before you try to interact with any of the element on a fresh loaded webpage you need to induce WebDriverWait for either of the following expected_conditions:
An example
Python:
Code Block:
driver.get("https://stackoverflow.com");
WebDriverWait(driver, 10).until(EC.title_contains("Stack"))
print("Page Title is : "+driver.title)
Console Output:
Page Title is : Stack Overflow - Where Developers Learn, Share, & Build Careers
Java:
Code Block:
driver.get("https://stackoverflow.com");
new WebDriverWait(driver, 10).until(ExpectedConditions.titleContains("Stack"));
System.out.println("Page Title is : "+driver.getTitle());
Console Output:
Page Title is : Stack Overflow - Where Developers Learn, Share, & Build Careers
Additional Considerations
You can find a detailed discussion in Which Firefox browser versions supported for given Geckodriver version?
- GeckoDriver is present in the desired location.
- GeckoDriver is having executable permission for non-root users.
- Upgrade Firefox version to Firefox v69.0 levels.
- Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
- If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
Test
as a non-root user.
- Always invoke
driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.
References
You can find a couple of relevant discussions in:
Outro
Occur the 'NS_ERROR_NOT_INITIALIZED' when switching the window to bottom dock.