c# - Get list of email and select top email with desired title/subject and click it -
i trying automated password recovery onto test script. trying email malinator.com, , looks like.
<li class="row-fluid message ng-scope" ng-repeat="email in emails"> <a style="cursor: pointer;" onclick="showmail('1411426607-6188591-xapncvfk501')"> <div class="from ng-binding" style="width:223px;float:left;"> mentor support </div> <div class="subject ng-binding" style="width:473px;float: left;"> recovered password </div> <div class="time ng-binding" style="text-align: right;float:left;width:144px;padding: 0 5px 0 5px;margin:0;"> 16 minutes ago </div> </a> </li> <li class="row-fluid message ng-scope" ng-repeat="email in emails"> <a style="cursor: pointer;" onclick="showmail('1411426524-6185292-xapncvfk501')"> <div class="from ng-binding" style="width:223px;float:left;"> mentor support </div> <div class="subject ng-binding" style="width:473px;float: left;"> recovered password </div> <div class="time ng-binding" style="text-align: right;float:left;width:144px;padding: 0 5px 0 5px;margin:0;"> 18 minutes ago </div>
here code:
iwebelement container = driver.findelement(by.id("mailcontainer")); ilist<iwebelement> emails = container.findelements(by.cssselector("[class$='ng-binding']")); string[] title = new string[emails.count]; (int = 0; < title.length; i++) { title[i] = emails[i].text; } (int = 0; < title.length; i++) { if (title[i].contains("mentor support")) { return i.tostring(); } driver.findelement(by.linktext(title[i])).click(); }
what trying grab email list , whichever email contains 'recovered password' or mentor support title, click on topmost list. know second statement 1 giving me problems , im not sure if calling correctly. help.
i avoid trying automate 3rd party email website part of testing.
using email providers api programmatically , read email faster , stable solution.
checkout this;
http://sellotapetest.blogspot.co.uk/2012/12/page-objectswhy-not-email-objects.html?m=1
Comments
Post a Comment