Dynamic value in string

How to handle dynamic value inside the string. for example below 10 and 15 will be dynamic value

Would you consider making an additional gift of $10 every month 15th to ?

Hi @grarun11,

This is covered in the documentation for using variables

For your specific question would be something like this:

   VAR   ${giftammount}    10
   VAR   ${dayofmonth}    15
   VAR   ${qstring}    Would you consider making an additional gift of \$${giftammount} every month ${dayofmonth}th to ?
   Log    ${qstring}

Dave.

1 Like

Thanks Damies.

But I don’t know the value. Its dynamic.

Hi @grarun11 ,

The first 2 lines was just to give the variables a value so this was a working example, the 3rd line is what you need for your test case, just replace the variable names with the ones you want.

Dave.

Hi,

Can your precise where the values come from?

  • Either from a locator in the page (with a Get Text or Attribute Value)
  • From a condition that gives 10 and 15 (here I would use a corresponding table)
  • If the values are totally random, then I don’t see how you can validate it’s correct if you don’t know what expect. Here the best would be to use regex or glob pattern to replace the values in the obtained variable. At least regex verifies the text, and returns the two values in the string for check.

Regards
Charlie

15 is current date so I used now{} but 10 varies depends on the amount. I can use gettext and get that value