Can I delete only the part of the text in the field on the website?

Can I delete only the part of the text in the field on the website?

Hi, I’d like to only delete the text “YYYYY” but leaving XXXXX without disturbing element there in the text field on the web. HTML is like below.

<p><span><span draggable="true">XXXXX</span>YYYYY</span></p>

where XXXXX and YYYYY varies time to time.

I know I can select the UiElement for YYYYY by using FindChildren and Get Ancestor, but if I use “Get Text” to get “XXXXXYYYYYY”, put it into some variable, and somehow get rid of XXXXX, will be gone when I past it back to the field.

So I think I’ll have to select/highlight the exact text I want to delete in the field but not getting the text into the variable.

Is there any good way to do this?

Thanks in advance!

Hi
Hope these steps would help you resolve this
—use CLICK ACTIVITY on that element
—then use SEND HOT KEY activity with key as ctrl+a
—another another send hot key activity with key as ctrl+c
—now use a activity called GET FROM CLIPBOARD activity and store that in a variable of type string named str_input
—then use a ASSIGN activity and mention like this
str_output = str_input.ToString.Replace(“yourword”,”tobereplacewithword”)

—then use SET TO CLIPBOARD activity and pass the variable str_output as input
—now use SEND HOT KEY activity with key as ctrl+v in that same field

Cheers @vapodego

1 Like

Thanks @Palaniyappan !

Sorry, I missed the important part in the question… I need <span draggable="true"> to be there after modifying the text.

If I use your method, my understanding is that <span draggable="true"> will be gone when converting it to String. or wouldn’t it?

I hope we need to check that once on changing the value Like whether is it getting changed or not
Did we try that buddy
@vapodego