2016-06-27 2 views
0

enter image description here 행이있는 페이지에서 행 데이터를 기반으로 행을 삭제하려고합니다. 즉 행이 여러 개인 경우 행 (셀) 데이터그랜드 자식 형제를위한 xpath를 작성하는 방법

데이터를 읽을 수 있으며 삭제 버튼을 별도로 식별 할 수 있습니다.

하지만 하나 이상의 행이있는 경우 삭제 버튼에 2 개 이상의 일치 항목이 표시됩니다.

그래서 셀 데이터를 기반으로 행을 삭제하고 싶습니다.

부모와 시도 할 때 < < >> 자식 노드 로직 행 데이터를 기반으로 삭제 버튼을 찾을 수 없습니다.

아래는 내가 시도한 xpaths입니다. 누군가 올바른 방법을 제안 해 줄 수 있습니다 xpath.

xpath

은 행 데이터 찾을 수 있습니다 :

//div[@class='ui-grid-draggable-row ng-scope ng-isolate-scope']/div/div[contains(@title,'ART_Location')] 

xpath 삭제 찾을 수를 버튼 :

//div[@class='ui-grid-draggable-row ng-scope ng-isolate-scope']/div/div/button[@class='delete-data-collectors-monitor'] 

내가 모두 XPath의 (삭제와 행 데이터) 여기에

xpath= //div[@class='ui-grid-draggable-row ng-scope ng-isolate-scope']/div/div[contains(@title,'ART_Location')]/../button[@class='delete-data-collectors-monitor'] 

을 결합하는 경우 삭제 버튼이 식별되지 않는 경우 pls가 제안합니다.

+0

'/ div [@ class = 'ui-grid-draggable-ng-scope ng-isolate-scope'] (div/div/@ title, 'ART_Location')/div/div/button [ @ class = 'delete-data-collectors-monitor'] ' – splash58

+0

당신의 의견에 스플래쉬 주셔서 감사합니다, 나는 요소를 얻을 수 없습니다. 하지만 부모 클래스로 돌아 가면 /../ .. 버튼을 칠 수 있습니다. // div [@ class = 'ui-grid-draggable-row ng-scope ng-isolate-scope']/div /div[@title='ART_Location']/../../div/div/button[@class='delete-data '] –

답변

0

xpath을 사용해보세요. 당신의 삭제 버튼을 마지막 열 인 경우

.//div[text()='ART_Location']/../..//button[@class='<class name of the button>'] 

, 다음 xpath 아래를 사용

.//div[text()='ART_Location']/../div[last()]/div/button[@class='<class name of the button>'] 

을 특정 위치가 다음 xpath 아래의 사용에서 당신의 삭제 버튼이있는 경우 :

.//div[text()='ART_Location']/../following-sibling::div[position()=<position number from the ART_Location div>]/div/button 

희망이 도움이됩니다.

+0

감사합니다. –