'site url'中发生错误:未捕获的TypeError:无法使用Selenium和Python读取未定义的属性'getColomnSet' [英] An error has occured in 'site url': Uncaught TypeError: Cannot read property 'getColomnSet' of undefined with Selenium and Python
问题描述
我正在尝试使用Selenium for Python和Chrome webdriver来自动下载文件。
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:
'url'中出现错误:未捕获TypeError:无法读取未定义的属性'getColomnSet'
此错误意味着什么以及最可能的原因是什么?
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()
推荐答案
此错误消息...
An error has occured in 'site url': Uncaught TypeError: Cannot read property 'getColomnSet' of undefined
...暗示您的程序在尝试下载所需文件时无法读取属性 getColomnSet 。
...implies that your program was unable to read the property getColomnSet while trying to download the desired file.
可能是主要问题是在客户端呈现 js 完全=nofollow noreferrer> HTML DOM 。
Possibly, the main problem is the js
involved to download the document is invoked before the client renders the HTML DOM completely.
相关的 HTML ,多一点之前的代码行以及错误堆栈跟踪会让我们更多地了解出现了什么问题。
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.
- 您可以采取一些措施等到完成 DOM树 :
- 在您的代码试验中,我没有看到您与元素
(By.ID,'element_1_id')
进行交互,所以可能你可以为元素(By.ID,'element_1_id')
删除presence_of_element_located()
的步骤。 - 如果您仍然需要
presence_of_element_located((By.ID,'element_1_id'))
捕获异常并启动所需步骤。 - 在 elem1 和 elem2 上调用
move_to_element()
并向前调用<$ c> $ c> perform()你需要诱导 WebDriver等待与 expected_conditions aselement_to_be_clickable(locator)
- 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 ofpresence_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 invokeperform()
you need to induce WebDriverWait with expected_conditions aselement_to_be_clickable(locator)
- 使用画布无法读取属性'getContext'为null
- 未捕获的TypeError:无法读取undefi的属性getContext ned
- 未捕获错误remote.js
- Cannot read property 'getContext' of null, using canvas
- Uncaught TypeError: Cannot read property 'getContext' of undefined
- Uncaught Error remote.js
这篇关于'site url'中发生错误:未捕获的TypeError:无法使用Selenium和Python读取未定义的属性'getColomnSet'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- 在您的代码试验中,我没有看到您与元素