hi there i am trying to test a scenario where mockmail sends an email with a link, the user will clck on the link and he will be a verified user. heres my mockmail output:
14:52:04,664 INFO ~ From Mock Mailer
New email received by
From: Admin@xxx.com.tr
ReplyTo: Admin@xxx.com.tr
To: "xxx@hotmail.com" <xxx@hotmail.com>
Subject: Verification
text/html; charset=UTF-8: <html>
<body>
<p>Click here to verify your password: <a href="http://localhost:9000/usercontroller/verifyforgotpassword?uuid=6aaf15da-75ca-44f4-9d3d-c9056d33e142"/></p>
</body>
</html>
and heres my selenium code:
#{selenium}
open('/usercontroller/forgotpassword')
type('userid','stat-011032')
click('btnLogin')
storeLastReceivedEmailBy('xxx@hotmail.com', 'email')
store('javascript{/Subject:\s+(.*)/.exec(storedVars["email"])[1]}', 'subject')
assertEquals('Verification', '$[subject]')
#{/selenium}
i can extract the subject value from the email but i dont kow how to extract the link from the tag from the mail body.
Thanks for helping...
Use this commands
store('javascript{/http:[^\s]+/.exec(storedVars["email"])[0]}', 'confirmationUrl')
open($[confirmationUrl])
Hope it helps :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.