Descriptive Programming with Variables on the Data Table
Question ID: 104135
3
0

I’m trying to use descriptive programming and a parameter from the local data table to click on a link. The descriptive I’m using is outertext and the outertext is stored as a parameter on the Local Data Table. This is what I have:

Browser("title:=Browser").Page("title:=Page").Link("outertext:=outerTextInfo").Click

What I want to do is use DataTable("Category", dtLocalSheet) in place of outerTextInfo but I can’t seem to get the proper syntax. How should this be coded?

Marked as spam
Posted by (Questions: 2, Answers: 3)
Asked on June 17, 2010 2:45 pm
179 views
Answers (3)
3
Private answer

Set a variable for DataTable(''Category'', dtLocalSheet)
Example:
Category=DataTable(''Category'', dtLocalSheet)

Next, use that variable as the ''outertext.''
Example:
Browser(''title:=Browser'').Page(''title:=Page'').Link(''outertext:''&Category).Click

Make sure the variable is concatenated onto ''outertext:'' and is NOT within the quotation marks (''''). This way, the Link will use the varable Category instead of looking for ''outertext:=Category''. Make sense?

Marked as spam
Posted by (Questions: 1, Answers: 1)
Answered on June 17, 2010 6:34 pm
3
Private answer

Petri basically had the correct format, except that you need to use the := between the property and the property value. If you are using a variable, you do have to make sure that the variable is not inside of the quotes like Petri mentioned, because it will be interpreted as a literal value instead of a variable. No matter what property or property value combination you use, the pattern of := is always the same (also there are not spaces between the property, the := and the value). If you find that QTP does not recognize the object with a single property/value combination, you can use multiple sets, just make sure they are separated by commas outside of the pair. Try this modified code from the above examples:

outerTextInfo = DataTable(''Category'', dtLocalSheet)
Browser(''title:=Browser'').Page(''title:=Page'').Link(''outertext:='' & outerTextInfo).Click

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on June 28, 2010 2:10 pm
2
Private answer

Try this:

Browser(''micClass:=Browser'').Page(''micClass:=Page'').Link(''name:=BlahBlah'').Select DataTable.value(''Category'',dtGlobalSheet)

Marked as spam
Posted by (Questions: 2, Answers: 1)
Answered on June 17, 2010 3:01 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top