robotframework - How to click the link in email body and how to spot out the link using Robot Framework -
how spot out link , click link email body.
${field name}= imaplibrary.get links email ${latest} ${mailbody}= imaplibrary.get email body ${latest} ${html}= imaplibrary.open link mail ${latest}
but when give "get email body", i'm able total content in email body. how spot out links there , how click there?
to find links need use regexps. example stackoverflow question answers how find urls in text: regex find urls in string in python
it looks in robot framework:
*** settings *** library re *** variables *** ${mailbody} mail body http://www.stackoverflow.com/ foobar https://stackoverflow.com/questions/31288261/how-to-click-the-link-in-email-body-and-how-to-spot-out-the-link-using-robot-fra *** settings *** library re *** variables *** ${mailbody} mail body http://www.stackoverflow.com/ foobar https://stackoverflow.com/questions/31288261/how-to-click-the-link-in-email-body-and-how-to-spot-out-the-link-using-robot-fra ${url regexp} http[s]?://(?:[a-za-z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fa-f][0-9a-fa-f]))+ *** test cases *** urls @{lines}= re.findall ${url regexp} ${mailbody} log many @{lines}
you cannot click links, instead should use selenium2library open them in browser.
Comments
Post a Comment