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!
Hello @CHEN_YIJIAN ,
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.
Regards,
Rohith
Hi,
Another approach:
As it seems StudioX, ModifyText activity might be better, as the following.
Regards,
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
Hello @CHEN_YIJIAN
Kindly try this, Use regex and seperate the number with converted Integer
TotalPage=
cint(System.Text.RegularExpressions.Regex.Match("Total10Pages","\d+").ToString.Trim)
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.