March 11, 2011

Allowing popup windows from a website using registry functions

[+] void AllowPopups (string sHTTPServer)
    [ ]
    [ ] Reg_CreateKey (HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\New Windows\Allow")
    [ ] Reg_CreateValue (HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\New Windows\Allow", sHTTPServer, "REG_BINARY: 0x0000")

// Example: AllowPopups ("http://www.yahoo.com")

Deleting browser cookies and temporary internet files using command prompt


// Silk Test code to delete cookies using command line.

[+] void DeleteCookies()
    [ ] // Close All Browsers
    [ ]
    [ ] SYS_Execute("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2")


Here are the different options for various tasks:
================================================

echo Clear Temporary Internet Files:
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

echo Clear Cookies:
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2

echo Clear History:
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1

echo Clear Form Data:
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16

echo Clear Saved Passwords:
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32

echo Delete All:
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

echo Delete All w/Clear Add-ons Settings:
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 435

For more details click here.

March 07, 2011

Capturing screenshot and window declarations when an error occurrs in the testcase execution.


// To achieve this you need to override the recovery system, you need to write your own TestCaseExit function as below.

[-] void TestCaseExit (boolean bException)
   [ ]
   [ ] List of string lsErrorPageDeclarations
   [ ] string sExceptionBitmapFile = "AbsoluteBitmapFilePath"
   [ ]
   [-] if bException == True
      [ ] // Test case failed
      [ ]
      [ ] // Delete any bitmaps from a previous Exception.
      [-] if SYS_FileExists(sExceptionBitmapFile)
         [ ]
         [ ] SYS_RemoveFile(sExceptionBitmapFile)
      [ ]
      [ ] // Go to the top of the form.
      [ ] BrowserPage.Click(1,1,1)
      [ ] BrowserPage.TypeKeys("")
      [ ]
      [ ] Desktop.CaptureBitmap (sExceptionBitmapFile)
      [ ] lsErrorPageDeclarations = BrowserPage.GenerateDecl ()
      [ ]
      [ ] Print("---------------------------------------------------------------------------")
      [ ] ResOpenList ("The declarations for the current BrowserChild are:")
      [ ] Print("---------------------------------------------------------------------------")
      [ ]
      [ ] ListPrint (lsErrorPageDeclarations)
      [ ]
      [ ] ResCloseList()