Monday, June 7, 2010

GetCellData

Function name: GetCellData
Purpose: To fetch values from the cell specified Row and Column of the Grid Control
Definition: GetCellData(int nRow, int nCol)
Parameters:
nRow: Index of the Row to fetch Cell Value
nCol: Index of the Column to fetch Cell Value
Returns: Value in the specified cell
Usage:
Browser(Obj).Page(Obj).Webtable(Obj).GetCellData (4,4)

Execute File Function

This can be used to execute an external VB Script File
Syntax: ExecuteFile FileName
Example : ExecuteFile “C:\sample.vbs”
The above discussed functions can be easily accessed by step Generator:

When working in the Expert View, you should bear in mind the following general VBScript syntax rules and guidelines

• Case-sensitivity—By default, VBScript is not case sensitive and does not differentiate between upper-case and lower-case spelling of words, for example, in variables, object and method names, or constants.

For example, the two statements below are identical in VBScript:
Browser("Mercury").Page("Find a Flight:").WebList("toDay").Select "31"
browser("mercury").page("find a flight:").weblist("today").select "31"

Text strings—When you enter a value as a text string, you must add quotation marks before and after the string. For example, in the above segment of script, the names of the Web site, Web page, and edit box are all text strings surrounded by quotation marks. Note that the value 31 is also surrounded by quotation marks, because it is a text string that represents a number and not a numeric value.

In the following example, only the property name (first argument) is a text string and is in quotation marks. The second argument (the value of the property) is a variable and therefore does not have quotation marks. The third argument (specifying the timeout) is a numeric value, which also does not need quotation marks.
Browser("Mercury").Page("Find a Flight:").WaitProperty("items count", Total_Items, 2000)
• Variables—You can specify variables to store strings, integers, arrays and objects. Using variables helps to make your script more readable and flexible. For more information, see Using Variables.
• Parentheses—To achieve the desired result and to avoid errors, it is important that you use parentheses () correctly in your statements. For more information, see Using Parentheses.

• Comments—You can add comments to your statements using an apostrophe ('), either at the beginning of a separate line, or at the end of a statement. It is recommended that you add comments wherever possible, to make your scripts easier to understand and maintain.

• Spaces—You can add extra blank spaces to your script to improve clarity. These spaces are ignored by VBScript.

To specify a variable refer to an object, use the Set statement, with the following syntax:
Set ObjectVar = ObjectHierarchy
In the example below, the Set statement specifies the variable UserEditBox to store the full Browser > Page > WebEdit object hierarchy for the username edit box. The Set method then enters the value John into the username edit box, using the UserEditBox variable:
Set UserEditBox = Browser("Mercury Tours").Page("Mercury Tours").WebEdit("username")
UserEditBox.Set "John"

Note: Do not use the Set statement to specify a variable containing a simple value (such as a string or a number). The example below shows how to define a variable for a simple value:
MyVar = Browser("Mercury Tours").Page("Mercury Tours").WebEdit("username").GetTOProperty("type")
You can also use the Dim statement to declare variables of other types, including strings, integers, and arrays. This statement is not mandatory, but you can use it to improve the structure of your test or component. In the following example, the Dim statement is used to declare the passengers variable, which can then be used in different statements within the current action.

Dim passengers
passengers = Browser("Mercury Tours").Page("Find Flights").WebEdit("numpassengers").GetROProperty("value")