Struggling a bit to simultaneously understand WebDriverJS and promises... and most of the sample code out there is for Python/Java, not Javascript. All I'm trying to do is to get the full html for a page. So if you look at the same code for WebDriverJS:
var webdriver = require('selenium-webdriver');
...
driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnG')).click();
driver.wait(function() {
return driver.getTitle().then(function(title) {
return title === 'webdriver - Google Search';
});
}, 1000);
I'm trying to simply return the entire html document instead of just the title. In Python that'd be driver.page_source. I learn much better from examples so I'm a bit flummoxed here.