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

regex2bin2brobot2bframework-1851653

2.Use Should Match Regex keyword

should2bmatch2bregex2bkeyword2bin2brobot-8923462

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

 

Was this article helpful?
YesNo

Similar Posts