Normally when Auth prompt is shown the focus is automatically placed in the 'username' field.
So if we type username and press <TAB> then it goes to password. If we type it and press <TAB> again it goes on the login button so hitting it brings us where we need. So script would look like:
Global.DoSendKeys("username");
Global.DoSendKeys("{TAB}"); // Switch to password field
Global.DoSendKeys("password");
Global.DoSendKeys("{TAB}"); // Switch to 'Login' button
Global.DoSendKeys(" "); // Hitting SPACE or ENTER presses the button
Beauty of this method is that it is cross browser.
Navigation
If auth prompt is shown on the first page of the site then you may start your script like that:
Navigator.Open('https://outlook.office365.com/ews/exchange.asmx');
Global.DoSleep(3000);
Global.DoSendKeys("username");
Global.DoSendKeys("{TAB}"); // Switch to password field
// ...
Navigator.Open opens specified web page with the selected browser. However the depending on the browser the .Open call may be blocked for few seconds (as of today IE - 30 seconds, FireFox - 10 seconds, Chrome - no blocking).
One approach is to just let it wait as long as needed. However there is a way to make it faster. We may use Global.DoLaunch to open browser and navigate to specific page. This way browser instance is launched but Rapise does not yet try to attach to it, so there is no blocking. So attaching will be done later after entering the prompt:
Global.DoLaunch('iexplore.exe https://outlook.office365.com/ews/exchange.asmx');
Global.DoSleep(3000);
Global.DoSendKeys("username");
Global.DoSendKeys("{TAB}"); // Switch to password field
// ...
Button Click
Another scenario is when Authentication prompt usually shown when you click on some button on the page.
In this case it is important to use 'Physical' click rather than event click because event gets blocked by the prompt.
So if your script gets locked at line like:
SeS('ShowAuthBtn').DoClick();
Then you may need to enforce real click like that:
SeS('ShowAuthBtn').DoMouseMove(5,5); // Move over button with offset 5,5
Global.DoClick(); // Do simple left mouse click at current point