How to parameterize your link

上一篇 / 下一篇  2006-12-22 02:38:45 / 个人分类:QTP

There is a better way to parameterize your link. We could utilize Descrīption object since it has 5 method following provided:

 Add Method

Count Property

Remove Method

RegularExpression Property

Value Property

  

Let’s read info from a XML / Excel file first, and pass to Data Table.

And then, extract the value from Data Table, put it into Descrīption object, then we could use it.

In this way, we could easily maintain our application configuration (like hostname or URL) when the environment changed.

 

Here is sample code

 

*****************************************************

For intLoop = 1 to N

    strText=DataTable.Value(...)

    Set LinkDesc = Descrīption.Create()

    LinkDesc ("Text").Value = strText

    Browser("").Page("").Link(LinkDesc).Click

    DataTable.GetSheet("").SetNextRow

Next

*****************************************************

 


TAG: QTP

 

评分:0

我来说两句

我的栏目

日历

« 2024-05-09  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 3857
  • 日志数: 7
  • 建立时间: 2006-12-19
  • 更新时间: 2008-10-17

RSS订阅

Open Toolbar