2014-01-06 2 views
1

//a[class='btn btn-invisible btn-link routeLink'] and //a[data-route='#Leads']으로 XPath를 만들고 싶습니다.Selenium Webdriver - XPath : xpath에 'and' '또는'를 사용하는 방법

다른 예 : //div[@class='btn-group'] and //a[@text()='Leads']

HTML : 두 번째 예에서

<div class="btn-group" style="display: none;"> 
<a class="btn btn-invisible btn-link routeLink" data-route="#Leads" href="#Leads">Leads</a> 
+0

질문을 게시하기 전에 서식을 확인하고 미리보기를 확인하십시오. 귀하의 HTML이 사라졌습니다. –

답변

1

당신이 필요합니다.

2
//a[@class='btn btn-invisble' and data-route='#Leads'] 

: 당신이 사업부를 원하거나 당신이 앵커를 싶은가? 다른 로케이터가되어서는 안됩니까?

파이프를 사용하여 또는 그럴 수 있습니다. //div[@class='x']|//a[@text='aa'].

1) //a[@class='btn btn-invisible btn-link routeLink'][@data-route='#Leads'] 


2) //div[@class='btn-group'][text()='Leads'] 

을하고 당신이 정말로 사용 '과'해야하는 경우 다음 niharika_neo의 제안도 작동합니다 : 나는 아래에 생각

관련 문제