Not able to capture values using regex

42 Views Asked by At

I need to capture Username,Password (from the text below Login:-'Username : Admin Password : admin123') from URL https://opensource-demo.orangehrmlive.com/web/index.php/auth/login using regex,i have tried below code but its capturing entire string, can you help me in understand what went wrong here.

grab value from "orangehrm-login-error" and save it as "CRedentials"
grab value of regex "Username : [A-Za-z]+ Password : admin123" from stored value "CRedentials" and save it as "Uname"
grab value of regex "Username : Admin Password : [A-Za-z0-9]+" from stored value "CRedentials" and save it as "Pword"
enter stored value "Uname" into "Username"
enter stored value "Pword" into "Password"
1

There are 1 best solutions below

0
P.Das On

the regex pattern is not correct, actually. I have fixed this; please check the script below.

open url "https://opensource-demo.orangehrmlive.com/web/index.php/auth/login"
grab value of "(?<=Username : )[A-Za-z]+" and save it as "capturedUsername"
grab value of "(?<=Password : )[A-Za-z0-9]+" and save it as "capturedPassword"
enter stored value "capturedUsername" into "Username"
enter stored value "capturedPassword" into "Password"
click "Login"