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

2023-05-15前端开发问题
10

本文介绍了“站点 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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

    The End

相关推荐

js删除数组中指定元素的5种方法
在JavaScript中,我们有多种方法可以删除数组中的指定元素。以下给出了5种常见的方法并提供了相应的代码示例: 1.使用splice()方法: let array = [0, 1, 2, 3, 4, 5];let index = array.indexOf(2);if (index -1) { array.splice(index, 1);}// array = [0,...
2024-11-22 前端开发问题
182

JavaScript小数运算出现多位的解决办法
在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会...
2024-10-18 前端开发问题
301

jQuery怎么动态向页面添加代码?
append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href...
2024-10-18 前端开发问题
125

JavaScript(js)文件字符串中丢失"\"斜线的解决方法
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转...
2024-10-17 前端开发问题
437

layui中table列表 增加属性 edit="date",不生效怎么办?
如果你想在 layui 的 table 列表中增加 edit=date 属性但不生效,可能是以下问题导致的: 1. 缺少日期组件的初始化 如果想在表格中使用日期组件,需要在页面中引入 layui 的日期组件,并初始化: script type="text/javascript" src="/layui/layui.js"/scrip...
2024-06-11 前端开发问题
455

Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript
Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)...
2024-04-20 前端开发问题
5