How to write a dynamic Xpath using Javascript / Puppeteer

How we can write a dynamic xpath for puppeteer Automation? For example I have two xpaths with same right and left boundary as you can see below:

//*[@id='gridBodyTable_primaryField_{7B7C22C8-9EBE-EB11-A84A-000D3A95E99D}_0']
//*[@id="gridBodyTable_primaryField_{051E841E-B9BE-EB11-A84A-000D3A95E99D}_0"]

The numbers/alphabets inside the curly brackets {7B7C22C8-9EBE-EB11-A84A-000D3A95E99D} are dynamically generated. However the rest of the body always remains the same.



Read more here: https://stackoverflow.com/questions/68465166/how-to-write-a-dynamic-xpath-using-javascript-puppeteer

Content Attribution

This content was originally published by ava at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: