Another aspect is using the standard locators in UI element locators. Let me explain with one example. I had a OR condition in the element locator. In non standard locators, I am forced use this following script
Check if Element A is present
if A is present click A
Click Element B
Which means I need to make at least two calls to check if the particular element is present.
Consider the multiple selector option and multiple attribute selector in jQuery,
Click (Element A,Element B)
If I can use the above selector formats, just one step is enough. Add to this how many lines I don’t need to type to check this. Instead of four lines, script will have only one line. I choose jQuery as example. Those formats are actually CSS selectors.
Next time if you’re still using a old custom format for element locators, think about CSS.