4 행 4 열의 테이블이 있습니다. 마지막 두 열에는 두 개의 단추가 있습니다. 시작 및 취소. 두 번째 행/마지막 열의 취소 버튼을 누릅니다. 각 행의 코드는 비슷합니다 ... 시작하려는 서비스 이름을 뺀 것입니다.Follow-Sibling을 사용하여 테이블 안의 버튼을 클릭하십시오. PYTHON
행 1 장난감 서비스 1
행 2 장난감 서비스 2
행 3 장난감 서비스 3 :
<table class="table">
<tbody>
---this is the first row---
<tr ng-repeat="toyService in theService" ng-class="{'text-muted':toyservice.notFound" class="ng-scope">
--- this is the second row.. the row I am trying to start----
<tr ng-repeat="toyService in theService" ng-class="{'text-muted':toyservice.notFound" class="ng-scope">
<td style="text-align:center">...</td>
<td class="ng-binding"> Toy Service 2 </td>
<td class="ng-binding">...</td>
<td class="toy-service-button-panel text-right">
----the first button (Start Button)
<button type="submit" class="btn btn-info">...</button>
----the button I am trying the click (Cancel)
<button type="submit" class="btn btn-success btn-sm"
<span title="Cancel Service">..</span>
각 행은 동일한 코드를 뺀 서비스 이름이
행 4 내가 뭘하려 장난감 서비스 4
했다 :
driver.find_element_by_xpath("//td[contains(text(), 'Toy Service 2')]/follow-sibling::td").find_element_by_css_selector("td[class='toy-service-button-panel.text-right']").find_element_by_css_selector("button[class='btn.btn-success.btn-sm']").click()
내가
이 문서 '에 대한 평가'실행하지 못했습니다라는 오류 얻을 : 문자열 // TD를 [포함 (text(), Toy Service 1 ')]/follow-sibling :: td'는 유효한 XPath 표현식이 이 아닙니다.
driver.find_element_by_xpath("//td[contains(text(), 'Toy Service 2')]/following-sibling::td")
, 나는 '돈 :
나는 다른 방법을 시도했다하지만 난 행에이 취소 버튼을 클릭 할 수없는 것 2
감사합니다. 이것은 더 잘 작동합니다. – royalblue