QTP tips(2)

發表于:2011-10-09來源:未知作者:領測軟件測試網采編點擊數: 標簽:qtp
特定字符的零次或多次匹配 ( * ) 特定字符的一次或多次匹配 ( + ) 特定字符的零次或一次匹配 ( ? ) 對正則表達式進行分組 ( ( ) ) 匹配幾個正則表達式中的一

  特定字符的零次或多次匹配 ( * )

  特定字符的一次或多次匹配 ( + )

  特定字符的零次或一次匹配 ( ? )

  對正則表達式進行分組 ( ( ) )

  匹配幾個正則表達式中的一個表達式 ( | )

  在一行的開始進行匹配 ( ^ )

  在一行的結尾進行匹配 ( $ )

  匹配包括下劃線在內的任一字母數字字符 ( \w )

  匹配任意非字母數字字符 ( \W )

  11、如何判斷Excel進程是否存在?

  如何判斷Excel進程是否存在?如果存在則關閉Excel進程。

  SystemUtil.CloseProcessByName "excel.exe"

  On error resume next

  Dim Obj

  Set Obj = GetObject(,"Excel.Application")

  If Not Obj Is Nothing Then

  Obj.Quit

  Set Obj = Nothing

  End If

  或者:

  ' To kill excel application

  CreateObject("WScript.Shell").Run "taskkill /f /im excel.exe"

  'To check if excel is running use this function

  msgbox "Excel is Running:" & FindProcess("EXCEL.EXE")

  Function FindProcess(ByVal ProcessName)

  FindProcess= False

  Set Shell = CreateObject("WScript.Shell")

  Set ShellResult = Shell.Exec("TaskList")

  While Not ShellResult.StdOut.AtEndOfStream

  If Instr(UCASE(ShellResult.StdOut.ReadLine),UCASE(ProcessName)) Then

  FindProcess = True

  Exit Function

  End If

  Wend

  End Function

  12、如何在瀏覽器對象的指定位置按右鍵?

  hwnd = Browser("Browser").GetROProperty("hwnd")

  window("hwnd:=" & hwnd).Click 12,6,micRightBtn

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97