Protractor console log

前端 未结 6 1471
[愿得一人]
[愿得一人] 2020-12-04 16:48

I want to output the text of a div in my protractor test, so far I have:

console.log(ptor.findElement(protractor.By.id(\'view-container\')).getText());
         


        
6条回答
  •  借酒劲吻你
    2020-12-04 17:05

    getText and most other Protractor methods return promises. You want to put your console.log statement inside the promise resolution:

    Using the new Protractor syntax:

    element(by.id('view-container')).getText().then(function(text) {
      console.log(text);
    });
    

提交回复
热议问题