How to Use a Parentheses in QTP or UFT?

0
47
Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

 

How to Use a Parentheses in QTP or UFT?

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 below…
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 an If statement, or if you are using the Call keyword to call an action. You also need to add parentheses around the name of a checkpoint if you want to retrieve its return value.
Tip: If you receive an Expected end of statement error 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.
Following are several examples showing when to use or not use parentheses.

How to Use a Parentheses in QTP or UFT?

To achieve the desired result and to avoid errors, it is important that you use parentheses () correctly in your statements. For more information, see below…
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 an If statement, or if you are using the Call keyword to call the action. You also need to add parentheses around the name of a checkpoint if you want to retrieve its return value.

Tip: If you get an Expected end of articulation error message when running a stage in your test, it might show that you have to include brackets around the contentions of the progression’s strategy.

Following are a few precedents appearing at use or not utilize brackets
The following example requires parentheses around method arguments since it returns a value to a variable.


Set WebEditObj = Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").ChildItem (8, 2, "WebEdit", 0)
WebEditObj.Set "Example"
The following example requires parentheses around method arguments, since Call is being used.
Call RunAction("BookFlight", oneIteration)
The following example requires parentheses around method arguments, since the method is used in an If statement.
If Browser("index").Page("index").Link("All kind of").WaitProperty("attribute/readyState", "complete", 4) Then
Browser("index").Page("index").Link("All kind of").Click
The following example requires parentheses around method arguments, since it returns the value of the checkpoint.
a = Browser("MyBrowser").Page("MyPage").Check (checkPoint("MyProperty"))
The following example does not require parentheses around the Click method arguments, since it does not return a value.
Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").Click 3,4

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


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

The following example requires parentheses around method arguments, since Call is being used.


Call RunAction("BookFlight", oneIteration)
 

The following example requires parentheses around method arguments, since the method is used in an If statement.


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

The following example requires parentheses around method arguments, since it returns the value of the checkpoint.


a = Browser("MyBrowser").Page("MyPage").Check (checkPoint("MyProperty"))

The following example does not require parentheses around the Click method arguments, since it does not return a value.


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

 

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

LEAVE A REPLY

Please enter your comment!
Please enter your name here