VBScript Built in Functions

VBScript Built in Functions 1) Asc Function It returns ANSI character code for first letter of a string or number. ‘A to z (65 to 90) ‘a to z (97 to 122) ‘0 to 9 (48 to 57) Example: Dim a a =”ABCD” Msgbox Asc(a) ’65 Msgbox Asc(“A”) ’65 Msgbox Asc(“Z”) ’90 Msgbox Asc(“a”) ’97 … Read more

VBScript FileSystemObject

VBScript FileSystemObject File System Operations i) What is Computer File System? It is a feature of Operating system used to work with Drives, Folders and Files. ii) Examples for File System Operations Create a Folder Copy a Folder Delete a Folder Create a Text file Delete a Text file Read data Write data Comparisons Search … Read more

VBScript Tutorial 10

VBScript Tutorial 10 (Error Handling, Debugging Scripts) Error Handling using VBScript: Handling expected and unexpected Errors > Expected Errors: Whenever we use Invalid input then we can expect Errors. Note: We use Invalid input for Negative Testing. > Unexpected Errors i) Resource missing ii) Insufficient Resource iii) Resource Response How to Handle Errors: i) Using … Read more

VBScript Tutorial 9

VBScript Tutorial 9 (VBScript Excel Application Operations – 2, Database Operations and Dictionary Object) Excel Data Comparison Examples: 1) Read data from an Excel file and Compare 2 Columns (One to One Binary Comparison). Dim objExcel, objWorkbook, objWorksheet, i, RowsCount Set objExcel = CreateObject(“Excel.Application”) Set objWorkbook = objExcel.Workbooks.Open(“C:\Users\gcreddy\Desktop\abcd.xls”) Set objWorksheet = objWorkbook.Worksheets(1) RowsCount = objWorksheet.UsedRange.Rows.Count … Read more

VBScript Tutorial 8

VBScript Tutorial 8 (Excel Object Model in VBScript) Excel Application operations using Excel Application Object Excel Application Object: It is used to perform operations on Excel Application. Create Excel Application Object: Set Variable = CreateObject(“Excel.Application”) ———————- Excel Application Excel Workbook / File Excel Worksheet / Sheet Excel File Operations using VBScript Examples: 1) Create an … Read more

VBScript Tutorial 7

VBScript Tutorial 7 (VBScript File System Operations Part-2) 6) Create a Text file Note: File System Object is only used for Drives, Folders and Flat files. We can create and delete other types of also, but we can’t perform internal operations like Reading, Writing etc… Dim objFso Set objFso = CreateObject(“Scripting.FileSystemObject”) objFso.CreateTextFile “C:\Users\gcreddy\Desktop\QTP.txt” objFso.CreateTextFile “C:\Users\gcreddy\Desktop\QTP.doc” … Read more

VBScript Tutorial 6

VBScript Tutorial 6 (VBScript Built in Functions Part-2, File System Operations part-1) I) VBScript Built in Functions Part-2 20) LCase Function Converts Upper case values to lower case. Ex: Dim val val = “HYDERABAD” Msgbox LCase(val) ‘hyderabad Msgbox LCase(“HYDERABAD”) ‘hyderabad Msgbox LCase(“hyderabad”) ‘hyderabad Msgbox LCase(“HYDerabad”) ‘hyderabad Msgbox LCase(“HYD123”) ‘hyd123 Msgbox LCase(123) ‘123 —————————- 21) UCase … Read more

UFT Class 36

UFT Class 36 (UFT Error Handling Part-1) Handling Expected and Unexpected Errors is called Error Handling. Expected Errors: Whenever we use invalid input then we can expect errors. Why we need to use Invalid input? We use invalid input for negative Testing. Unexpected Errors:——————— i) Resource response: ii) Insufficient Resource: iii) Availability of the Resource: … Read more

UFT Class 35

UFT Class 35 (Object Identification Configuration Part-2, UFT Tool settings configuration, Dictionary Object) i) How to configure single object? Open Object Repository > Select Object Add Property and Value ii) How to maintain different configurations for same environment? 3 web Application Steps: First Configure Object Identification according to 1st Application > generate Script and store … Read more

UFT Class 33

UFT Class 33 (Debugging Tests, Database Objects and VBScript Examples) What is Debugging? Locating and isolating errors thru Step by step execution. Debugging is optional. When Debugging is required? Whenever Test is not showing any errors and not providing correct output. How to debug? Using VBScript debug commands and breakpoints. i) Step into (F11) a) … Read more