Friday, April 25, 2008

Loading a URL - Silktest

Silktest has two methods LoadPage and Navigate to load particular page or URL. Sometimes our project may have modal popups like network authentication or Certificate Security (SSL) popups before loading the page. At that time we can not use LoadPage and Navigate methods. Silktest is used to expect the browser, should be ready. In case of modal dialog box, browser will be active if the modal dialog box is closed.

To solve this problem, we need to type the URL and then hit ENTER key in the browser. Then verify for the possible popups and do appropriate actions. Few people might be using SetTrap and ClearTrap. Trapping can be done for the popups, which are not required any inputs. Below I have given a code snippet.

Code:



[ ] Browser.SetActive ()
[ ] Browser.Maximize()
[ ] Browser.Location.SetText ("{sUrl}")
[ ] Browser.Location.TypeKeys ("")
[ ] Sleep (2)
[+] if (BrowserSecurityInfo.Exists(5))
[ ] BrowserSecurityInfo.SetActive ()
[ ] Print ("BrowserSecurity Info Exists.")
[ ] BrowserSecurityInfo.Continue.Click ()
[+] if (BrowserAuthentication.Exists(5))
[ ] BrowserAuthentication.SetActive ()
[ ] BrowserAuthentication.UserName.SetText (sUsername)
[ ] BrowserAuthentication.Password.SetText (sPassword)
[ ] BrowserAuthentication.OK.Click ()

No comments: