So I am trying to speed up my tests built using the recorder in TP then running through BrowserStack virtual Android device.
I was reading on BS site the following
- Use fast selectors in test scripts
Among the many locators that can be used in Selenium Webdriver, it is best to use the fast ones. A few of them are:
- search by ID
- NAME selector
This locator functions if the element being located has a name attribute.
- XPath selector
XPath selector is known for providing flexibility, but are the slowest of all selectors. This is because the browser DOM of the webpage needs to be traversed in order to find the specific element. When writing scripts, use XPath selectors as rarely as possible.
- CSS selector
CSS Selector is faster than XPATH but definitely lacking in terms of flexibility.
As far as possible, incorporate the strategies discussed above into the creation of Selenium test scripts. By shaping test cases in a way that makes them run faster, it reduces test times. This means bugs are identified and resolved faster. Overall, it reduces the time to push new code to production.
So My question is how to use ID instead of CSS Selector or XPATH as I only see options for
XPATH, CSS Selector, Tag Name and LInk Text. How do I add ID? Is there a setting to change?