Forum Discussion

acm's avatar
acm
Contributor
8 years ago

How to Extract and Save a "substring" into a Variable for separate tests?

Good day,

 

Please see the image attached, the text string "Event id: 2172 Status: Work in progress" appears in the top right corner.  It is a long string found within CSS selector, 

#ismheader > header > div.event-message

 

How would you save "2172" for later use?  The goal here is to save the Event ID number (2172) and retrieve its details in a separate keyword test.

 

Thank you.

 

Regards,

Arlene

 

 

  • In your case, you can use Set Variable Value.  Pick your variable and then use Code Expression to get the string with your own InputString, StartPosition, and Length.