Issues with removing text from a webfield

I have the text & logos in the form of code.

Could you give the original flow a try with this view? The form should be much easier to work with than the editing applet.

I try and unfortunately there are two problems after to click on “source”:
1- I can’t select my paragraph of interest alone
2- With send hotkey “Ctrl + a” and then “back”, the bot select all the text and all characters of the page and then back to the previous page too :frowning:

If it selects all text, that’s already a good sign. Probably using the del key will do the trick.

As to the selecting the paragraph, it probably is now encapsulated with some tags. You will need to find pieces of your text and see how to adapt your replace/remove method.

I try too with “Del” Send Hotkey, unsuccessfully.

I try in the “element scope” and the Ctrl + a" and then “del” work. Good thing.
Now I shoud to found, how to select my paragraph of interest, I think that Get text not work in that case.

Good to hear we went a step further :slight_smile:

I would say it should. Try first the Get Text on your form box and then output the content to the console with a simple Write Line activity (or write it to a text file).

Then it’s a matter of locating your string and finding and removing it.

Once again, a working example with a simple website on the entire process of changing the top line :slight_smile:
SendHotkeys_v3.zip (32.4 KB)

Get text and Get ocr text doesn’t work

That is really surprising, but another way would be to use Copy Selected Text activity after selecting the text with Send Hotkey Ctrl + A (which is confirmed to be working).

You also mentioned that the Get OCR text doesn’t work. Does it mean that no options of the Screen Scraping wizard work here? Screen Scraping wizard is a fast way to get feedback of what is possible on the page and it creates 1 activity at the end: Get Full Text. It might be the way to go here to debug the issue a bit.

That doesn’t work because I should to select manually the text for my paragraph. To select all the text it’s ok.
So Send hotkey “ctrl + a” select all the text, not one part as I would like now ^^

Indeed with Screen Scraping is better

I test all that and I let you know

The point here is to copy entire string to the variable, modify this variable and then replace the entire textbox with the edited variable.

It is okay to select the entire text :slight_smile:

After you loaded that entire long and awkward string to a variable, modifying it is as easy as:

yourLoadedString.Replace("yourStringToBeReplaced","")

This will replace your paragraph with nothing, effectively removing it.

After that, you just have to paste the string in the box again.

It is possible to do it seemingly, such as:

  1. Send Hotkey Ctrl + A to select all
  2. Copy Selected Text to a variable called inputString
  3. Send Hotkey del to delete the content of the box already
  4. Assign activity to modify your string:
modifiedString = yourLoadedString.Replace("yourStringToBeReplaced","")
  1. Set To Clipboard activity to set your newly modified string
  2. Send hotkey Ctrl + V to paste the modifiedString back to the textbox.
2 Likes

ok but I should to add an activity. Indeed, I need to extract “yourStringToBeReplaces” to a variable because it’s a HTML code so I can’t to put in directly in an Assign activity as you can see:

This is happening due to the double quotes. Every double quote needs to be ‘escaped’ with another double quote.

This will not work:
at your earliest convenience.</span></span></span></p>",""
But this will work for sure:
at your earliest convenience.</span></span></span></p>"",""""

I’ve just tested it and the alternative is to load your long string from a text file. After I loaded the string from a text file into a variable, I could use this syntax in the replace Assign activity literally:

modifiedString = yourLoadedString.Replace("yourStringToBeReplacedLoadedFromTxtFile","")

2 Likes

Indeed with double double quotes the assign is valid.

So I do:
1- Scrap all the text to a variable (VariableText)
2- I assign my variable text as here: VariableText = VariableText.Replace(“the text code of the paragraphe of interest”, " ")
3- I Set to clipboard my VariableText
4- Send Hotkey “Ctrl + a”
5- Send Hotkey “Del”
6- Send Hotkey “Ctrl + v”
7- Click again on Source to check

And… It’s work :smiley:
Thanks a very much @loginerror for your help :wink:

2 Likes

I’m glad it works! :slight_smile:

Finding these workarounds is what RPA is really about :smiley:

1 Like

This just started to happen with the 19.11.1 UiPath.UIAutomation.Activities and the UiPath.System.Activities 19.10.1 updates. This happens with me as well.