TestProject Forum
Powered by leading experts in the test automation community

TestProject is unable to find the element on the page when using parameter

I have recorded a test where I am creating an Invoice with an Invoice Number on it which is a random number which I am generating with the help of the random number generator. Then, I am also storing that random number in a parameter. If you see the screenshot below, the element is there on the page with the same XPATH as what was recorded. But when I change the Invoice Number (178) in the element with the PARAMETER, where I stored that Invoice Number, it is not finding that element on that page. I also tried counting the number of spaces and everything is looking good but still it is unable to find that element with that XPATH. Please let me know what is going wrong in this scenario?

Here is the parameter value of Invoice Number in my test.

A couple of ideas to help debug:

  • Can you locate the element using a similar (without a parameter) XPath from the developer tools console with javascript / jQuery (using for example: $x("[xpath]") or a CDP friendly tool like SelectorsHub?

  • Does it help if you add another XPath locator to the referenced element?
    For example: //a[contains(string(),'{InvoiceNumber}')]

@nathan1, thank you so much for helping out. It worked when I used XPATH as //a[contains(string(),’{InvoiceNumber}’)]