开发者

WebDriver Automation on verifying an email

开发者 https://www.devze.com 2023-04-10 01:50 出处:网络
I\'m using WebDriver and Java to automate some web pages. I have a scenario that I\'m not sure the best way to manage. A website provides the option to leave a comment, but if you are not a user it se

I'm using WebDriver and Java to automate some web pages. I have a scenario that I'm not sure the best way to manage. A website provides the option to leave a comment, but if you are not a user it sends you the email with a link to click to a开发者_运维百科ctivate the user and add the comment. Is there a clean way to automate leaving the site to wait for the email, and when it's found clicking the link.


Consider using JavaMail API and HTTPURLConnection. This is what I do in a similar testing scenario.

While running the webdriver test, after doing certain action if you expect an email then using JavaMail API poll (for a certain timeout if its not immediate) for the email in the background with certain 'subject' or 'sender' etc. Once the email is found then grab the link from the email content and then simulate a click using HTTPURLConnection


You could use GreenMail - it is embeddable test mail server( it is to mail server what h2 and hsql are to databases), wait for sending and receiving of email - parse the email and continue with you test

http://www.icegreen.com/greenmail/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号