Automation text box - bump in the road

uiautomation
studio

#1

Hi!

I’m having trouble automating one of the steps in my first automation, would appreciate any help.

  • I want to replace text value in a text box on a web page. https://imgur.com/EEF2l7i
  • If “CLIENTKEY=-1” the value “-1” must be replaced with “1” within the text box.
  • It’s always named the same, but can differ on placement within the box.

I can’t figure out how to “text exists” “CLIENTKEY=-1” inside a box like this, and then “IF” it to get replaced by new value “1”.


#2

Can you try and use a ‘Get Text’ activity on the text box? If correctly, it should return the entire text in the text box. Then you can continue with Regex Matches to find the value of CLIENTKEY, to find if it’s -1. Then if it is, you can replace the text you retrieved from the text box, and paste it back in. In short it will be like this:

  1. Use ‘Get Text’ on the text box, name the output string: textboxOutput
  2. Use ‘Matches’ activity on the output string, in “pattern” put “(?<=CLIENTKEY=)-?1”, set output variable to clientkey
  3. Use ‘Assign’ to get the value: clientkeyvalue = clientkey(0).ToString
  4. If clientkeyvalue = “-1”, then use Assign as follows: textboxOutput = textboxOutput.Replace(“CLIENTKEY=-1”,“CLIENTKEY=1”)
  5. Finally: use type into (with “Empty Field” selected) to type back the textboxOutput

That should do the trick :slight_smile: