F
F
fandorin_official2020-01-13 16:42:57
Python
fandorin_official, 2020-01-13 16:42:57

Why does Selenium write Exception... "Component not initialized"?

There is a piece of code where I can't figure out what the error is.
So:

def delete_widget(self, widget):
    try:
 <b>button_delete_widget = widget.find_element_by_css_selector("i.icon-trash.icon-2x")</b>
    except NoSuchElementException:
    self.add_widget(widget)
    sleep(WAIT_PERIOD)
    self.driver.switch_to.window(self.driver.window_handles[-1])
    button_delete_widget = widget.find_element_by_css_selector("i.icon-trash.icon-2x")
    button_delete_widget.click()
    self.wait_and_accept_allert(count=1)

def add_widget(self, widget):
    element.click()

The snag lies in the "fat" line of code.
Sometimes, Selenium works correctly and code execution goes to NoSuchElementException, but sometimes, I get the following error:
selenium.common.exceptions.WebDriverException: Message: [Exception... "Component not initialized" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: chrome://marionette/content/modal.js :: get window :: line 199" data: no]

What could be causing this?
Why does Selenium write Exception... "Component not initialized"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alfss, 2020-01-13
@alfss

NS_ERROR_NOT_INITIALIZED (0xC1F30001)
An attempt 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 other methods are used.

The content didn't load.
Here is about the same problem https://stackoverflow.com/questions/57950661/compo...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question