我如何从网站上获取动态元素,以便我可以在夜间观看

发布于 2025-01-18 14:52:35 字数 232 浏览 1 评论 0原文

我想获得“取消”元素。但是取消按钮的元素是动态的,如下所示: 在此处输入图像描述

//*[@id="TD/D0202/22/00321-content"]/div/button[1]/span

如何在 Nightwatch 脚本中使用该元素?

I want to get "Cancel" element. But the element of Cancel Button is dynamic, like this :
enter image description here

//*[@id="TD/D0202/22/00321-content"]/div/button[1]/span

How can i use the element to my nightwatch script?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人哭 2025-01-25 14:52:35

CSS 选择器:

span[class = "MuiButton-label"]
button[class*= "MuiButtonBase"] span[class = "MuiButton-label"]

XPATH 选择器:

//span[@class = "MuiButton-label"]
//span[@class = "MuiButton-label" and contains(text(), "Cancel")]
//button[contains(@class, "MuiButtonBase")]/span

有很多可能性来捕获此元素。

CSS Selector:

span[class = "MuiButton-label"]
button[class*= "MuiButtonBase"] span[class = "MuiButton-label"]

XPATH Selector:

//span[@class = "MuiButton-label"]
//span[@class = "MuiButton-label" and contains(text(), "Cancel")]
//button[contains(@class, "MuiButtonBase")]/span

There are a lot of possibilities to capture this element.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文