0

I am new to Selenium and in the process of learning selenium IDE. I am facing a difficult situation here. Any help would be much appreciated. So I am trying to copy part of a text message from my website. The message looks like "Your number is XXX" . I want to copy just the XXX and save it for a later use in a different browser session. This XXX number is dynamic and will give a new result each time.

Please advise.

  • possible duplicate of [Extract part of a text with selenium IDE and put it into variable](http://stackoverflow.com/questions/12861218/extract-part-of-a-text-with-selenium-ide-and-put-it-into-variable) – SiKing Jun 13 '14 at 15:18

1 Answers1

0

If your page structure allows you to get the entire message "Your number is 34343" using cssselector, Id, XPath, etc, then you will need to get the whole sentence, save it into a variable (you can save into a string variable". Then, you need to search for number in that string. You can use regular expression as well:

numberString = Regex.Match(entireString, @"\d+").Value;

Or you can write your own custom method to extract number from the string.