Verify Email verification through python selenium

186 Views Asked by At

I aam trying to automate signup page and when i click on signup button it send an email of verificaion. How to automate this process without going to my email account with using selenium python.

i have tried mailinator api with selenium. But mailinator blocks it after detecting its a automation script

1

There are 1 best solutions below

0
On

i have implemented it on java through Mailinator's API. but you could try to do the same on python.

public class MailinatorEmail {

public final String domain = "domain";
public final String inbox = "local-part";

//Connect to Mailinator
MailinatorClient mailinatorClient = new MailinatorClient("YourTeamAPIToken");
Document document;

public MailinatorEmail() {
    document = getDocument();
}
public Document getDocument() {
    Inbox pm = mailinatorClient.request(GetInboxRequest.builder()
            .domain(domain)
            .limit(1)
            .skip(0)
            .sort(Sort.DESC)
            .build());

    //Get message
    Message message = mailinatorClient.request(new GetMessageRequest(
            domain,
            inbox,
            pm.getMsgs().get(0).getId()));
    List<Part> parts = message.getParts();

    //Pars email HTML
    return Jsoup.parse(parts.get(0).getBody());
}

//Get link from email
public String getUrl() {
    Elements button = document.select("set_your_locator");
    String url = button.get(0).attributes().get("set_your_locator2");
    System.out.println(url);

    return url;
}

}