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

An error has occured in #39;site url#39;: Uncaught TypeError: Cannot read property #39;getColomnSet#39; of undefined with Selenium and Python(“站点 url中发生错误:未捕获的类型错误:无法使用 Selenium 和 Python 读取未定义的属性“getColomnSet)
本文介绍了“站点 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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

    本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

SCRIPT5: Access is denied in IE9 on xmlhttprequest(SCRIPT5:在 IE9 中对 xmlhttprequest 的访问被拒绝)
XMLHttpRequest module not defined/found(XMLHttpRequest 模块未定义/未找到)
Show a progress bar for downloading files using XHR2/AJAX(显示使用 XHR2/AJAX 下载文件的进度条)
How can I open a JSON file in JavaScript without jQuery?(如何在没有 jQuery 的情况下在 JavaScript 中打开 JSON 文件?)
quot;Origin null is not allowed by Access-Control-Allow-Originquot; in Chrome. Why?(“Access-Control-Allow-Origin 不允许 Origin null在铬.为什么?)
How to get response url in XMLHttpRequest?(如何在 XMLHttpRequest 中获取响应 url?)