找到具有动态属性的元素

发布于 2025-02-10 23:02:47 字数 146 浏览 2 评论 0原文

我一直在使用Selenium Java和HTML更改中的每个运行元素属性进行一些测试。我正在使用Selenium 4.1.2和MVN 3.8.5从IntellijIDE中测试一个完整的Web应用程序,而Web App .Net和Angular 13。 知道这个问题的原因是什么?

I ve been running some tests using selenium java and after every run element attributes in HTML change. I am testing a full web app from intellij ide using selenium 4.1.2 and mvn 3.8.5 while the web app .NET and Angular 13.
Any idea what is the cause of this problem ?

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

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

发布评论

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

评论(1

-黛色若梦 2025-02-17 23:02:47

您可以通过两个mwthods找到它,如果部分属性值是静态的,剩余的值是动态的,请说id = abc123,而123是动态的,而ABC是静态的,请尝试将XPath尝试与contains(@ID,'abc' )或尝试找到一个静态和使用以下方法的先前元素来遍历和找到此元素

You can locate it by two mwthods 1) if part of the attribute value is static and the remaining value is dynamic lets say id=ABC123 and the 123 is dynamic and ABC is static try to use xpath with contains (@id,'ABC') or try locate the previous element which is static and use following method to traverse and locate this element

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