2014-06-20 3 views
0

i를 elementCss = 'ABC', 일부 정크 값이 항상 다음 절에 해결하는 경우에도 오류가 발생한 부분을ptor.findElements는 항상 true를 돌려

ptor.findElements(protractor.By.css(elementCss)).then(function (elems) { 
           element = elems; 
           elementFound = true; 
           // if element.all(...).count() 
           console.log("inside then clause , Element Found"); 
          }, function (err) { 
           console.error("waiting for element(" + elementCss + ") to be found " + currentCount + "/" + timeout); 
          }); //ptor.findElement 

를 실행하지 다음과 같은 코드를 가지고 하지 그 /는 정크 CSS 이름이기 때문에 거부/오류에 빠지게됩니다.

findElement는 예상대로 작동합니다. 내가 여기서 뭔가를 놓치고 있니?

답변

0

에 대한 API findElement은 지정된 선택기에서 요소를 찾을 수없는 경우 오류를 반환합니다.

에 대한 API findElements은 선택기가 요소와 일치하지 않으면 빈 목록을 반환합니다. findElement documentation에서

:

If the element cannot be found, a bot.ErrorCode.NO_SUCH_ELEMENT result will be returned by the driver 
관련 문제