2016-12-29 7 views
0

XML 결과의 텍스트를 어설 션하는 방법을 찾고 있습니다. 일부 웹 서비스를 테스트하는 데 사용하고 있습니다.Selenium IDE에서 XML 응답을 응답합니다.

XML은 다음과 같습니다

<ProductsResult> 
    <Total>12679</Total> 
    <Duration>4099</Duration> 
    <Hits> 
     <Product> 
     <ProductNumber>ABC</ProductNumber> 
     </Product> 
    </Hits> 
    <HitsByProductNumber> 
     <Product> 
     <ProductNumber>ABC</ProductNumber> 
     </Product> 
    </HitsByProductNumber> 
</ProductsResult> 

지금 내가 ProductNumber 태그를 확인해야하지만, 단지 "조회수"태그에. 모든 ProductNumber 태그를 확인하는 데는 문제가 없습니다. 이렇게하면됩니다.

<html> 
    <body> 
     <table> 
     <tbody> 
      <tr> 
       <td>clickAndWait</td> 
       <td>css=input.button</td> 
       <td></td> 
      </tr> 
      <tr> 
       <td>assertXpathCount</td> 
       <td>//*[name() = 'ProductNumber' and text() = 'ABC']</td> 
       <td>1</td> 
      </tr> 
     </tbody> 
     </table> 
    </body> 
</html> 
+0

무엇이 질문입니까? – Dee

+0

"조회수"태그에서 "제품"을 확인하는 방법 – Senni

+0

해결책을 찾았습니다. 그것은 쉬웠다 ... // * [name() = 'Hits']/* [name() = 'Product'] :) – Senni

답변

0

답변을 찾았습니다.

아주 쉬웠습니다.

나는 여전히 assertXpathCount를 사용하여 대상에 내가 사용

//*[name() = 'Hits']/*[name() = 'Product'] 

지금 나는 조회수 태그의 모든 제품에 액세스 할 수 있습니다.