//li[@title='workareaid'] id looks dynamic. Uncheck the id checkbox or delete the id…
- User
//li[@title='work_area_id'] id looks dynamic. Uncheck the id checkbox or delete the id attribute from attribute box to generate relative xpath without id if it is generated with id- This is the comment iam getting on above relative xpath , please correct and give correct x path as per the instruction.
- Assistant
To create a relative XPath for the element you mentioned, assuming it still contains the attribute
title='work_area_id'but without using the dynamicid, you can use the following relative XPath instead:xpath//li[@title='work_area_id']Since the comment suggests to avoid using the
idattribute but didn't mention any usage ofidin your original XPath, it seems that the XPath is already correctly addressing the element based on itstitle. However, if you need to ensure that you are not referencing any dynamicid, you can check for other stable attributes or the structure of the HTML.If there are no other attributes, and you want to keep it strictly to the , the provided XPath is valid. However, if you want to improve robustness by finding the element based on its context (like its parent or other siblings), you might use a slightly more context-aware XPath. Here’s an alternate approach using other attributes or the hierarchy: