hello to all the guys in the community !!
I wanted to ask for advice from the most expert in automation regarding selectors.
I would like to have some advice in order to have a very solid static and dynamic selector; what are the important elements that must always contain the selectors? how much must be detailed? what is superfluous and therefore can you very well omit?
I would like to know your ideas and be able to learn and improve my ideas.
Thanks in advance.
Be as specific as you can without it being overly specific.
Avoid anything with a specific name e.g. “Internet Explorer - Richard Denton” - instead wildcard “Internet Explorer *” thus ensuring it is still IE but will work for any name.
Also keep an eye out for changes between Dev, Test and Prod environments e.g. “SAPDEV123” might indicate that the selector will only work in the Dev environment
Try to avoid using ids unless you’re positive it’s always 1 or 2
Use aaname if it’s available (tends to be unique)
Keep an eye out for anything that changes, i.e. try reloading the page/application to see if it’s identical
Compare selectors on a page to see what’s consistent
Test, test, test!
For dynamic selectors, use the assign and then log to see clearly what you are trying to select rather than squeezing it all into the selector property with lots of && signs.
Hope that helps! I’m sure others will have more.