TestProject Forum
Powered by leading experts in the test automation community

Writing dynamic Xpath

Is there any way to construct Xpath at run time?
For Eg: //td[text()="%s"]/following-sibling::td[contains(text(),‘date’)]/following-sibling::td[last()]/ul/li/a

Here, in place of %s I have to place a value from Global Parameter list and date needs to be current date.

Hello @rkhanna
You can add parameters to the XPATH.
Edit the element:

And click on the +

Here you can insert parameters to construct the XPATH in runtime.

For the date, you can use the Get Current Date action and put the parameter there like I shown above.


1 Like

Got it. Thanks @ran.tzur