“站点 url"中发生错误:未捕获的类型错误:无法使用 Selenium 和 Python 读取未定义的属性“

时间:2023-05-15
本文介绍了“站点 url"中发生错误:未捕获的类型错误:无法使用 Selenium 和 Python 读取未定义的属性“getColomnSet"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在尝试使用 Selenium for Python 和 Chrome 网络驱动程序来自动下载文件.

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:无法读取 undefined41 的属性‘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" rel="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 树在讨论之后呈现:
    • 检查页面是否已在 Selenium 中完全加载的通用函数
    • 在您的代码试验中,我没有看到您与元素 (By.ID,'element_1_id') 交互,因此您可能可以删除 presence_of_element_located() 的步骤 对于元素 (By.ID,'element_1_id').
    • 如果您仍然需要 presence_of_element_located((By.ID,'element_1_id')) 捕获异常并启动所需步骤.
    • 当您在 elem1elem2 上调用 move_to_element() 并继续调用 perform() 时,您需要用 WebDriverWait.webdriver.support.expected_conditions" rel="nofollow noreferrer">expected_conditions 作为 element_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 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)
    • 无法使用画布读取 null 的属性getContext"
    • 未捕获的类型错误:无法读取未定义的属性getContext"
    • 未捕获的错误 remote.js

    这篇关于“站点 url"中发生错误:未捕获的类型错误:无法使用 Selenium 和 Python 读取未定义的属性“getColomnSet"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:如何通过 dockerfile 在 ENTRYPOINT 之前执行 shell 命令 下一篇:ElementClickInterceptedException:消息:元素单击被拦截元素不可点击错误单击使用 Sele

相关文章