2014-11-10 5 views
0

내가 각도기가 webdriverjs을 감싸 나는이 기능 I이 검색의 요소 발견이 사용하고 있습니다에 사업부 내에서 컨텐츠의 길이를 찾을 : 그 el.length 작동하지 않는 것을 알고Webdriverjs - 테스트

ptor.findElement(protractor.By.css('.rightPanel')).then(
     function(el) { 
     if(el.length > 0){ 
        ptor.switchTo().defaultContent(); 
        callback(); 
       }else{ 
        callback.fail("side panel is empty"); 
       } 
     }); 

합니다. 누구든지 내 div 내에서 Webdriverjs를 사용하여 일부 콘텐츠가 있는지 확인할 수있는 방법에 대한 제안이 있습니까? 감사.

답변

0

getInnerHtml() 기능은 어떻습니까?

ptor.findElement(protractor.By.css('.rightPanel')).then(
    function(el) { 
    el.getInnerHtml().then(
     function(html) { 
     if(html.length > 0){ 
      ptor.switchTo().defaultContent(); 
      callback(); 
     }else{ 
      callback.fail("side panel is empty"); 
     } 
     }); 
    }); 

이 너무 변덕 있다면 대신 getText() 기능을 시도 할 수 있습니다.