Home > database >  Locating elements with dynamic attributes
Locating elements with dynamic attributes

Time:06-29

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 ?

CodePudding user response:

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

  • Related