There is a text field on the page that I would like QTP to enter amount for me. The HTML ID of the field has a dynamic name gh44jer4u.Amount but ends with a word amount. How can I refer to that? Can I use Contains or Ends with inside html id?
Something like this:
Browser("Browser").Page("Page").WebEdit("html id:=.Amount").Set "348934"
When using descriptive programming UFT uses regular expressions. So the .
you're using is not the literal string "."
, rather it means any single character.
The description needs to fit the entire string so you need something like this.
.*\.Amount
Which according to regex101.com means:
/.*.Amount/
.*
matches any character (except newline)
Quantifier:*
Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
\.
matches the character.
literally
Amount
matches the charactersAmount
literally (case sensitive)
So the full line should be:
Browser("Browser").Page("Page").WebEdit("html id:=.*\.Amount").Set "348934"