如何找出元素被短暂禁用的原因? [英] How to find out why an element is disabled briefly?

查看:27
本文介绍了如何找出元素被短暂禁用的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写自动化代码以单击在 chrome 浏览器中打开的网页上的按钮.结果是按钮被快速加载到 DOM 上,但在几毫秒内不可点击.在禁用期间,它甚至没有被 GUI 标记为禁用.所以,我的自动化代码立即找到了按钮 &点击它,但没有任何反应.

I am writing automation code to click a button on a web page opened in chrome browser. Turns out that the button is loaded onto the DOM quickly, but is not clickable for a few milliseconds. During the disabled time, its not even marked as disabled by the GUI. So, my automation code instantly finds the button & clicks it, but nothing happens.

一个原因可能是在禁用期间按钮代码中有一个名为禁用"的属性.我如何确定情况确实如此?

One reason could be that there is an attribute called "disabled" in the button code during the disabled time. How do I find out that this is indeed the case ?

还有其他方法可以暂时禁用按钮/元素吗?如果是,请告诉我使用了哪些方法以及如何检查使用了哪种方法?

Are there any other methods to disable a button/element temporarily ? If yes, then please tell me which methods and how i can check which method was used ?

编辑 - 根据我的建议,我添加了代码以在页面加载时打印元素 html.html 中没有禁用属性.我错过了什么吗?

EDIT - Per rorys suggestion I added code to print element html upon page load. There is no disabled attribute in the html. Am I missing something ?

推荐答案

不看代码或预览问题本身,很难说.

Without seeing the code or previewing the problem itself, it's hard to say.

可能是按钮被添加到 DOM,但点击事件处理程序不会立即应用,这将使它看起来被禁用,直到它们被应用.

It could be that the button is getting added to the DOM, but the click event handlers aren't applied immediately, which would make it seem disabled, until they are applied.

可能暂时有一个禁用的属性,您可以很容易地在自动化代码中对其进行测试;即使它类似于 console.log(element); 在控制台中查看元素的 HTML.

It could be there's a disabled attribute temporarily, for which you could test with in your automation code easily enough; even if it's something like console.log(element); to view the HTML of the element in the console.

这篇关于如何找出元素被短暂禁用的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆