自动化测试专家,专注于自动化测试领域的框架开发及国外最新自动化技术,担任过银行、电子商务等项目的自动化测试工作,精通自动化测试工具QTP、Watir等.并对QTP有过深入的研究,有过企业内训和工具培训经验,希望能与各位同行一起沟通,交流,探讨。 zzxxbb112@hotmail.com

【QTP系列讲座 28】==正则表达式的应用 ==

上一篇 / 下一篇  2011-10-31 16:59:23 / 个人分类:QTP系列讲座

 Rss订阅IQuickTest关于如何订阅?51Testing软件测试网 _%v6rdWS0S}

GoogleReader订阅地址: http://feeds.feedburner.com/iquicktest

!\A+q,W.s4Do0

作者:zzxxbb112
时间:2010/2/23 版权所有,侵权必究。

F*Hfh0VX0

出处:http://blog.csdn.net/zzxxbb112

;c0T;E.f v0

正则表达式相信很多朋友都不陌生,它是一个非常常用的技术,不管是在什么语言中,今天我们就来看一下QTP中正则表达式的应用。

1\]H6L&i t t0
  • 描述性编程的应用

51Testing软件测试网2^|r&K;h r

  1. systemutil.Run "iexplore.exe","www.baidu.com"   
  2. Browser("title:=.*").Page("name:=.*").WebEdit("name:=wd").Set "zzxxbb112"  
51Testing软件测试网7i&o5Cd J

#r L.Lv o:F0

当我们在使用描述性编程时,我们可以使用正则来代替长标题 

3G5]}C6`)v9Xz0
  • VBS中REGEXP的应用

在VBS中有一个叫REGEXP的类,它提供了简单的正则支持51Testing软件测试网-}we?1vxi"aq*w

't*t4I8cQ4`0
  1. Function RegExpTest(patrn, strng)  
  2.    Dim regEx, Match, Matches   ' Create variable.  
  3.    Set regEx = New RegExp   ' Create a regular expression.  
  4.    regEx.Pattern = patrn   ' Set pattern.  
  5.    regEx.IgnoreCase = True   ' Set case insensitivity.  
  6.    regEx.Global = True   ' Set global applicability.  
  7.    Set Matches = regEx.Execute(strng)   ' Execute search.  
  8.    For Each Match in Matches   ' Iterate Matches collection.  
  9.       RetStr = RetStr & "Match found at position "  
  10.       RetStr = RetStr & Match.FirstIndex & ". Match Value is '"  
  11.       RetStr = RetStr & Match.Value & "'." & vbCRLF  
  12.    Next  
  13.    RegExpTest = RetStr  
  14. <span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style. initial; border-color: initial; border-top-style. none; border-

TAG: iquicktest QTP qtp

 

评分:0

我来说两句

我的栏目

日历

« 2024-04-19  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 32294
  • 日志数: 49
  • 建立时间: 2009-10-17
  • 更新时间: 2011-10-31

RSS订阅

Open Toolbar