An error has occured in 'site url': Uncaught TypeError: Cannot read property 'getColomnSet' of undefined with Selenium and Python

I am trying to use Selenium for Python eith the Chrome webdriver to automate the download of a file.

My program works perfectly up to the last step (clicking on the 'download' button) at which point a dialog box is triggered with the text:

"An error has occured in 'site url': Uncaught TypeError: Cannot read property 'getColomnSet' of undefined41"

What does this error mean and what are the most probable causes?

For reference, here are the last few commands of my program:

try:
    elem = wait.until(EC.presence_of_element_located((By.ID,'element_1_id')))
finally:
    elem1 = driver.find_element_by_id('element_1_id')
    elem2 = driver.find_element_by_id('element_2_id')
    action = ActionChains(driver).move_to_element(elem1).move_to_element(elem2)
    action.perform()
    elem2.click()

Solution 1:

This error message...

An error has occured in 'site url': Uncaught TypeError: Cannot read property 'getColomnSet' of undefined

...implies that your program was unable to read the property getColomnSet while trying to download the desired file.

Possibly, the main problem is the js involved to download the document is invoked before the client renders the HTML DOM completely.

The relevant HTML, a bit more of your previous lines of code and the error stack trace would have given us some more idea about what's going wrong.

Solution

  • You can induce some measures to wait till the complete DOM Tree is rendered following the discussion:
    • Generic funtion to check if page has completely loaded in Selenium
  • A couple of facts:
    • In your code trials I don't see you interacting with the element (By.ID,'element_1_id') so possibly you can remove the step of presence_of_element_located() for the element (By.ID,'element_1_id').
    • If you still require presence_of_element_located((By.ID,'element_1_id')) catch the exception and initiate required steps.
    • As you invoke move_to_element() over elem1 and elem2 and moving ahead invoke perform() you need to induce WebDriverWait with expected_conditions as element_to_be_clickable(locator)

tl;dr (references)

  • Cannot read property 'getContext' of null, using canvas
  • Uncaught TypeError: Cannot read property 'getContext' of undefined
  • Uncaught Error remote.js