Waiting for failure to validate internal HTML
For some reason, my assertion in protractor fails, what I am trying to do is get innerHTML (text) from the element:
var stuff = $('css').html();
expect (stuff) .toBe ("inner HTML text here");
I confirmed that it $().html()
gives the text I want on the console, what is wrong with my expected operation?
TypeError: Object [object Object] has no method 'html'
source to share
Use getInnerHtml()
expect($('.your-css').getInnerHtml()).toBe('your inner html');
http://angular.github.io/protractor/#/api?view=webdriver.WebElement.prototype.getInnerHtml
source to share
The error message indicates that whatever "$" object is returned does not have an "html" method.
If you expect "$" to be a jQuery reference, try using "jQuery" explicitly, for example.
var stuff = jQuery('css').html();
Also, I'm not sure if the selector in the above expression is your actual selector, if it is, it is looking for a "css" element that doesn't seem to be correct. You can take a look at this.
source to share