Selenium 通过 Data-Qa 属性查找元素 [英] Selenium find element via Data-Qa attribute
本文介绍了Selenium 通过 Data-Qa 属性查找元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经构建了我的 Selenium 框架.Data-QA 需要找到所有元素.我不确定如何做到这一点.我已经使用足够简单的 Id 完成了前面的工作.我在 find 元素中找不到数据 qa
I have building my Selenium framework. All the elements need to be found by Data-QA. I am unsure on how to do this. I have done the pervious using Ids that was simple enough. I cannot find data qa in the find element by
谁能指出我正确的方向.
Would anyone be able to point me in the right direction.
推荐答案
HTML 中似乎有额外的单引号,在双引号内:
It looks like there are extra single quotes in the HTML, inside the double quotes:
data-qa="'input_login_operator'"
我会从 DOM 中删除单引号,或者在 CSS 选择器中将它们转义.
I would remove the single quotes from the DOM, or escape them in the CSS selector.
这篇关于Selenium 通过 Data-Qa 属性查找元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文