This shows you the differences between two versions of the page.

Link to this comparison view

web_login_handling [2016/09/22 02:36] (current)
Line 1: Line 1:
 +===== Handling Basic Auth for Web Apps =====
 +Many web sites and web applications require some kind of access control to certain web pages. One way to do this is to use [[http://​en.wikipedia.org/​wiki/​Basic_access_authentication|HTTP Basic Authentication]]. There are others options but HTTP Basic Authentication is the most popular and easiest to configure and manage.
 +The use of such user authentication poses challenges to web app testing as the popup login window (example: http://​testoptimal.com/​img/​httpBasicAuth.png) can not be recognized by either Selenium or Htmlunit. TestOptimal addresses this problem with an mScript method $webAuth(...). The details and usage of this method is described below.
 +    $webAuth(authType,​ userID, password, waitMillis, gotoURL)
 +  * authType_p: the type of authentication currently only //​HttpBasicAuth//​is supported. Other types of authentications are in the works.
 +  * userID_p: the login user id
 +  * password_p: the password
 +  * waitMillis_p:​ number of milliseconds to launch the first page after logging in
 +  * gotoURL_p: first web page to goto after the logging in
 +   ​Example:​ $webAuth('​HttpBasicAuth',​ '​myId',​ '​myPwd','​500','​http://​myapp.abc.com'​)
 +All you have to do is to set your appURL for the model to any page protected by HTTP Basic Authentication and then place the above mScript method call in //​MBT_start//​ trigger. That's it.
 +Execute your model and you should see the HTTP Basic Authentication login window pop up, the system automatically enters the user id and password you supplied in //​$webAuth(...)//​ method and navigates to //​gotoURL_p//​ and your model execution continues.
QR Code
QR Code web_login_handling (generated for current page)