TestProject Forum

Issues with custom xpaths creation

Hi :slightly_smiling_face: I’ve became lost in the world of xpaths, so got an advice to create custom xpath, instead of coping this one, for example:

"/html/body/div[1]/div[4]/div[1]/div[7]/div/div[2]/div[3]/div/form/div[2]/div[3]/div[4]/div/div[1]/div/div/div[2]/div[1]/span[1]/span/span[1]/span/span/span/span/span[2]"

Found this link: How to Create Custom XPath
Tried in Chrome, right click, Inspect element, founding element and right click on Edit attribute. And my change, of course, was gone after refreshing. What I miss and should I need another tools?

TestProject recorder will create multiple locator strategies XPATH/CSS per element you interact with. As a good start you can simply interact with the desired element or click save element and locate one of the xpaths, here I added an example of dynamic xpaths created by TestProject the first 4 in this example should be less sensitive for changes. You can tweak the xpaths from this point and evaluate their strategy by pressing the "magnifying glass icon

I got it, don’t need any browser extension. It can be done only with TestProject recorder