3

Im using Sahi OS to look for emails in mailtrap shared inbox.

I can navigate to the folder, search for an email containing a string, do whatever has to be done and logout.

The issue is the speed.. It takes about 1 second for each step in navigation, thats OK. As soon as Sahi gets to the Inbox, it takes about 1-2 minutes for each step in search procedure.

here is my .sah

// Mailtrap check
loginMailtrap($mailtrapId, $mailtrapPwd);
gotoSharedInboxes();
checkForSmsTicketNumber($ticketNumber);
logoutMailtrap();

// Functions
function loginMailtrap($id, $pwd){
    _navigateTo($mailtrapUrl);
    _setValue(_emailbox("/email/"), $id);
    _setValue(_password("/password/"), $pwd);
    _click(_submit("Log in"));
    _assert(_isVisible(_heading2("/My Inboxes/")));
}

function gotoSharedInboxes();
    _click(_span("/Shared Inboxes/"));
    _click(_span("Shared Inbox Name"));
}

function checkForSmsTicketNumber($tn){
    var $smsTn = $tn.substr(5) 
    _log($smsTn);

    var $go = true;
    var $counter = 0;
    while ($go) {
        var $elm = _span(0, _in(_listItem($counter, _in(_list("messages_list inbox-content nav-list")) ) ));
        var $elmText = _getText($elm);
        _log($elmText);

        var $index = $elmText.indexOf($smsTn);

        if($index == -1){
            $go = true;
            $counter++;
        } else {
            $go = false;
            _click($elm);
            _assert(_isVisible($elm));
        }
    }
}

function logoutMailtrap(){
    _click(_div("/username/"));
    _click(_link("/Logout/"));
}

The email that Im looking for is the first in the list.

Step _log($smsTn) takes 2 minutes to complete after _click(_span("Shared Inbox Name"));

then it takes about 2 minutes for _log($elmText);

then 2 minutes for _click($elm);

then 2 minutes for logoutMailtrap();

Any ideas is Sahi parses mailtrap so slowly? Something todo with websockets? I dont have that issue with other sites. Thanks!

0 Answers0