javascript - WebdriverJS : driver.manage().logs().get('browser') returns empty array -
i have following mocha test case, i'm trying print webdriver logs in end, returning empty array. result same when pass 'browser' argument logs().get(). can please tell me why logs empty?
it('should open url', function(done){ var = nemo.wd.by; driver.manage().logs(); driver.get("http://www.google.com"); driver.findelement(by.name('q')).sendkeys("webdriver"); driver.findelement(by.name('btng')).click() driver.manage().logs().get('driver').then(function(logs){ console.log(logs); done(); }); });
it because didn't enable logging option in list of capabilities while creating driver instance. resolved these changes.
var pref = new webdriver.logging.preferences(); pref.setlevel('browser', webdriver.logging.level.all); pref.setlevel('driver', webdriver.logging.level.all); var driver = new webdriver.builder() .withcapabilities(webdriver.capabilities.firefox()) .setloggingprefs(pref).build();
Comments
Post a Comment