How to extract getText info?

i use getText to a web element which is to show how many pages the search result contains. i named getText result as “Result”, so “Result” now is “Total10Pages”, i wonder how i should manipulate “Result” to get “10” from it, because I need to use “10” as the loop number in my following automation process. thank you!


To extract Only number from : “Total10Pages” string use regular expression

  • Create a String Variable NumOfPages
    Assign NumOfPages = System.Text.RegularExpressions.Regex.Match(“Total10Pages”,“\d+”).Value

Here in Place of “Total10Pages” use your get text variable.


1 Like


Another approach:

As it seems StudioX, ModifyText activity might be better, as the following.


Hi @CHEN_YIJIAN, I hope you are doing well.
For your current problem I am attaching a workflow, I think it will help you to understand what to do with Result after you get it as an output from gettext activity.
Get_Pages.xaml (5.0 KB)

Have a good day!

Thanks & Regards,
Shubham Dutta

Kindly try this, Use regex and seperate the number with converted Integer


Now use Assign and set Count=1, where Count is int
Use While loop, ans set condition Count<=TotalPage
With in loop set assign fpe cpunt increment, Count=Count+1
The loop will based on TotalPage

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.