TestPlan How to extract a link from a text or html email
Document

How to extract a link from a text or html email

by Group Public on Friday January 16 2009 @ 20:56:35 (1/1 Points)

Tutorial ↪User Guide ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It

If you are sending emails as part of your web application is quite likely you will also send links as part of those emails. Links are usually used for confirmation, account information, or other purposes to direct a user to a specific part of a web application.

TestPlan provides the ability to easily navigate to those links whether you have a text or an html email.

Text Email

To extract a link from a text email you can use the function extractstring. This function takes a string and a pattern as the argument. For an email you can use the body of the message and a suitable regex.

The following example uses GetEmail, extracts the first http: link, and goes to that URL in the browser. That is, it simulates a user clicking on the link in the email.

GetEmail %User:Email%
set %ConfirmURL% as extractstring %Response://content% (http://.*)
GotoURL %ConfirmURL%

HTML Email

You can first use the SetEmailResponse function and then simply click normally.

GetEmail %User:Email%
SetEmailResponse text/html
click text:MyLink
© 2008-2010 edA-qa mort-ora-y
Using Persephone and TestPlan
Tag: