0

I am using Protractor wrapped around webdriverjs and I have this function finding the element I search for:

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

I know that el.length is does not work. Anyone has any suggestion on how I can make sure that within my div there is some content using Webdriverjs? Thanks.

Jenninha
  • 1,357
  • 2
  • 20
  • 42

1 Answers1

0

How about the getInnerHtml() function?

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");
        }
      });
  });

If that's too temperamental you could instead try the getText() function.

Nathan Thompson
  • 2,354
  • 1
  • 23
  • 28