Java game! Framework 1.2.4: Retrieving link value from Mockmail with selenium

Hi, I am trying to test a script when mockmail sends an email with a link, the user will contact the link and it 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 letter, but I do not know how to extract the link from the tag from the body of the letter.

Thanks for the help...

+3
source share
1 answer

Use these commands

store('javascript{/http:[^\s]+/.exec(storedVars["email"])[0]}', 'confirmationUrl')
open($[confirmationUrl])

Hope this helps :)

+2
source

All Articles