Copy specific part of a text in the browser

hi, this is my first question and i’m taking my first steps with RPA, i’m excited

I have a problem that I can’t find how to solve,
the process performs a charge data on a web form and then returns a result with the ticket number.

the text displayed by the browser is the following:

span id = “ctl00_cphContenciosa_lblNumeroTemis” style = “display: inline-block; width: 599px; left: -21px; top: 0px”> The number of Temis assigned to the judicial office is: CT237 /span

I need copy to the clipboard the ticket number (CT237) and paste only this number in a next step.

Can someone help me?

thanks a lot!

Hi,

The browser library keyword Get Text will give you the text value from an element. In this case the best selector for the element is possibly the “id” value. After that you need to discard everything before the last colon. Robot Framework comes with a built-in String library (https://robotframework.org/robotframework/latest/libraries/String.html) for this sort of stuff, and the keyword Fetch From Right is probably the most useful here.

So the end result would be something like this:

*** Settings ***
Library    RPA.Browser
Library    String

*** Keywords ***
Read ticket number
    ${text}=      Get text    id:ctl00_cphContenciosa_lblNumeroTemis
    ${ticket}=    Fetch from right    ${text}    :
    [Return]      ${ticket}
2 Likes

Great!!! thats works Perfect to me
Thanks to much!!