人生的意义,在人生之外,就如同工作的意义,在工作之外。 Cherish the people you meet everyday

VBScript何时用括号

上一篇 / 下一篇  2010-06-02 15:39:43 / 个人分类:QTP

When programming in VBScript, it is important that you follow the rules for using or not using parentheses () in your statements.

`9I G7L i?8a0

You must use parentheses around method arguments if you are calling a method that returns a value and you are using the return value. For example, use parentheses around method arguments if you are returning a value to a variable, if you are using the method in anIfstatement, or if you are using theCallkeyword to call an action. You also need to add parentheses around the name of a checkpoint if you want to retrieve its return value.

1mZ{ i7G+},HW0W;G0

Tip: If you receive anExpected end of statementerror message when running a step in your test, it may indicate that you need to add parentheses around the arguments of the step's method.

MkeL;R L0

The following examples show when to use or not use parentheses.

'F"n*W3m-]M%k'G@0

The following example requires parentheses around method arguments, since it returns a value to a variable:

PGN!`V8y*TN0

Set WebEditObj = Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").ChildItem (8, 2, "WebEdit", 0)

%u!`_f:m3\8["]i0

WebEditObj.Set "Example"

z3OEU3P&Lb4Y5r0

The following example requires parentheses around method arguments, sinceCallis being used:

v/L&rZ Eqc0

Call RunAction("BookFlight", oneIteration)

^$kv"t P-R8Q8H0

The following example requires parentheses around method arguments, since the method is used in anIfstatement:

A9\xyVc,p0

If Browser("index").Page("index").Link("All kind of").WaitProperty("attribute/readyState", "complete", 4) Then Browser("index").Page("index").Link("All kind of").Click

#o8uw_4\5O0

The following example requires parentheses around method arguments, since it returns the value of the checkpoint:51Testing软件测试网 Nf._.m5i

a = Browser("MyBrowser").Page("MyPage").Check (CheckPoint("MyProperty"))51Testing软件测试网 [.J/F ]y\

The following example does not require parentheses around theClickmethod arguments, since it does not return a value:51Testing软件测试网^kwh$\ Cy;F"c

Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").Click 3,4

D4y2Ks/eMM*Q@0

TAG:

 

评分:0

我来说两句

allenzgw

allenzgw

美国, 佛罗里达 Enjoy sand, sunshine, sailing.

日历

« 2024-03-02  
     12
3456789
10111213141516
17181920212223
24252627282930
31      

数据统计

  • 访问量: 162288
  • 日志数: 119
  • 图片数: 1
  • 书签数: 2
  • 建立时间: 2007-01-28
  • 更新时间: 2016-06-03

RSS订阅

Open Toolbar