There is a similar question out there (an older one in Python) but this one has to do with JS. Testing using Selenium in a NodeJS, Mocha environment. What I'd like to do is click on a Bootstrap dropdown and check the HTML to look for changes. I've tried the following:
test.it('should click on all header links',
function() {
var elem = driver.findElement(By.id('Profile'));
console.log(elem.getAttribute('innerHTML'));
console.log(elem.getInnerHtml());
});
Both calls return the same thing.
{ then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending] }
I plan to feed the HTML into cheerio so i can check for structure changes. Appreciate any help on this.
There is a similar question out there (an older one in Python) but this one has to do with JS. Testing using Selenium in a NodeJS, Mocha environment. What I'd like to do is click on a Bootstrap dropdown and check the HTML to look for changes. I've tried the following:
test.it('should click on all header links',
function() {
var elem = driver.findElement(By.id('Profile'));
console.log(elem.getAttribute('innerHTML'));
console.log(elem.getInnerHtml());
});
Both calls return the same thing.
{ then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending] }
I plan to feed the HTML into cheerio so i can check for structure changes. Appreciate any help on this.
Share Improve this question asked Jun 18, 2014 at 19:01 quikbeamquikbeam 3391 gold badge4 silver badges12 bronze badges2 Answers
Reset to default 6I was able to retrieve the HTML as a string by doing the following.
driver.findElement(By.id('Profile')).getAttribute("innerHTML").then(function(profile) {
console.log(profile);
});
I got the inner HTML with:
element.getAttribute('innerHTML').then(function (html) {
console.log(html)
})