If a part of class name is dynamic how can we handle in selenium with java?
EXP: --> the numeric part will change dynamically.
How can we identify this type of objects. Please help.
If a part of class name is dynamic how can we handle in selenium with java?
EXP: --> the numeric part will change dynamically.
How can we identify this type of objects. Please help.
Since you have not shared the sin-pest code which you have tried, I am taking an example of my own to give an answer to your question:
consider the below html code Buyer Attributes
In the above HTML code the class value is attr2group, that means 2 is not constant it will be changing dynamically.
so your xpath should be as below: //span[contains(@class,'attr')][contains(@class,'group')]
Hope this will help you
Please try to use regular expression and use "contains". During your element identification user class contains and provide the fixed sting name of the class.
ex: //*[contains(@class,'Your Fixed String name of class')]
Note: Assume that in the DON the class name is unique and no such other class has same name with a variable number attached. If so put the elements in a List and work that.