Verify Regex in Robot Framework?
Problem:- How to verify given regular expression using Robot Framework
Solution:-
A pessimist sees the difficulty in every opportunity; an optimist sees the opportunity in every difficulty
1.Create a regular expression using online tool
Example:- we want to verify 34.4% we will create a regular expression first
2.Use Should Match Regex keyword
Example 1 :-
We want to verify whether dynamic pattern like 34.4% exists on UI
Example2:-
Verify that uuid like 9100d6678-1b1c-45b445-bdf9-47bc0b15a603 exists on UI
Code:-
${cpuUsage} Get Text //test/div Should Match Regexp ${cpuUsage} ^[0-9]{1,2}[.][0-9]% CPU Usage validation ${uuidNumber} Get Text //test/div Should Match Regexp ${uuidNumber} [0-9a-z-] UUID validation