qileilove

blog已经转移至github,大家请访问 http://qaseven.github.io/

在QTP中申明XPath

 Example 1:
  <body>
  <h4>John Smith<input type=checkbox name="select" /></h4>
  <body>
  <h4>Anne Anderson<input type="checkbox" name="select" checked=true /></h4>
  In QTP:
  'Selecting John Smith
  Browser("XPath").WebElement("xpath:=//h4[1]").Click
  'Selecting Anne Anderson
  Browser("XPath").WebElement("xpath:==/h4[contains(text(), 'Anne')]").Click)
  Example 2:
  XPath:
  1. (//tr[@class='row2']/td[1])[2]
  2. (//td[contains(text(),'Address')])[2]
  In QTP:
  1. Browser("XPath").WebElement("xpath:=(//tr[@class='row2']/td[1])[2]").Click
  2. Browser("XPath").WebElement("xpath:=(//td[contains(text(),'Address')])[2]").Click
  Example 3:
  <table id='table1'>
  <tr class='row1' id=BPT>
  <td>View ID</td>
  <td><input type='button' value='Button 1' class='btn_blue' id='btnfirst'></td>
  </tr>
  In QTP:
  'Selecting Button 1
  Browser("XPath").WebButton("xpath:=//td/input[@id='btnfirst']").Click
  'Select Button 1
  Browser("XPath").WebButton("xpath:=(//table[@id='table1']/*/*)[1]/*[2]/input").Click

posted on 2014-07-22 09:20 顺其自然EVO 阅读(415) 评论(0)  编辑  收藏 所属分类: qtp


只有注册用户登录后才能发表评论。


网站导航:
 
<2014年7月>
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

导航

统计

常用链接

留言簿(55)

随笔分类

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜

评论排行榜