Knowledge Base Article

> Knowledge Base > Rapise

Created By  alexey.grinevich Tuesday, July 4, 2017

Some web site show Auth prompt when entering some area. The prompt is rendered differently by different browser. Here we show how to bypass the prompt in automation scripts.

Normally when Auth prompt is shown the focus is automatically placed in the 'username' field.

IE auth prompt

 

Chrome auth prompt

 

FF auth prompt

 

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.Navigate('https://outlook.office365.com/ews/exchange.asmx');
	Global.DoSleep(3000);
	
	Global.DoSendKeys("username");
	Global.DoSendKeys("{TAB}"); // Switch to password field
	
    ...

 

Navigator.Navigate opens specified web page with the selected browser. However the depending on the browser the .Navigate 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

 

Attachments

Selected files will be attached to any email sent on saving ticket.

file selected files selected  () Delete Selected

  • Created:
  • by:

Select files to upload

Or drag and drop files here

Uploading …
Done!
Upload More?
There was an error.
Try again?

Save to upload the selected file(s)

Article Info
  • Last Updated: 7/4/2017
  • Article ID: KB260
  • Views: 239