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
最新内容请见作者的GitHub页:http://qaseven.github.io/
相关资源:敏捷开发V1.0.pptx
转载请注明原文地址: https://yun.8miu.com/read-63402.html