以下 - 兄弟Python Selenium

时间:2016-12-13 17:27:58

标签: python selenium

我的桌子每行都有相同的2个按钮(开始,取消)。 我想点击第二行'免费玩具'上的'开始'按钮。有两个按钮紧挨着:1:取消2:开始。

如何点击位于第二行的免费玩具'开始'按钮?

driver.find_element_by_xpath("//td[contains(text(), 'FreeToys')]//following-sibling::button[@class='btn btn-success btn-sm']").click()

整个行的HTML代码

<tr ng-repeat="toyService in theServices" ng-class="{'text-muted': toyService.notFound}" class="ng-scope"> 
        <td style="text-align:center">
         <toy-up-down state="toyService.state" class="ng-isolate-scope"><span class="glyphicon glyphicon-arrow-down text-danger" title="Unknown" aria- hidden="true"></span></toy-up-down></td> 
   <td class="ng-binding">Free Toys</td> 
   <td class="ng-binding">Come get free toys</td> 
   <td class="toy-service-button-panel text-right">
          <button type="CANCEL" ui-sref="toyService.detail({id:toyService.id})" 
                 class="btn btn-info btn-sm toy-service-button-margin"info btn-sm toy-service-button-margin"                   
           ==The button I am trying to click is located below===
         <button type="START" class="btn btn-success btn-sm" (toyService.packageName)" 
                 ng-show="toyService.state !== 'Operational'" ng-disabledng-click="theStartClick
                  ="toyService.notFound" tabindex="0" aria-hidden="false" aria-disabled="false"> 
       </span> </button> 
       </td> </tr>

0 个答案:

没有答案