"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

April 19, 2015

Testcomplete - VBScript Notes

Tip #1
Change browser locale setting using registry edit. IE browser locale changes

'Browser language local setting function
Sub SetLanguage_FR()
Set wshShell = CreateObject( "WScript.Shell" )
wshShell.RegDelete "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International\AcceptLanguage"
wshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International\AcceptLanguage", "fr-FR", "REG_SZ"
Set wshShell = Nothing
End Sub

Tip #2
Dictionary object example in VBScript

Sub CreateDictionaryExample()
'Dictionary Adding Values
 set ExpectedValues = CreateObject("Scripting.Dictionary")
   ExpectedValues.add "label17", "User Name:"
   ExpectedValues.add "label23", "Password:"
   ExpectedValues.add "label2", "Please enter Details"
   ExpectedValues.add "Btnlogin", "Submit"
  'Dictionary Listing Values
   nofElemtns = ExpectedValues.Count
   keys = ExpectedValues.Keys()
     for i=0 to nofElemtns-1
        k = keys(i)
        v = ExpectedValues.Item(k)
        Call Log.Message(k & ": " & v)
End Sub 

Tip #3 - Disable windows pop up 'Your computer is at Risk' feature. 
This link . was useful to fix group policy changes

Tip #4 - Vbscript Kill all browser instances
This stackoverflow code snippet link was useful 

Happy Learning!!!

No comments: