I have a protractor setup with several browsers configured through multiCapabilities , running tests in a browser.
One of my specs / tests of the prototype key contains the following afterEach() block:
afterEach(function() { browser.manage().logs().get("browser").then(function (browserLog) { expect(browserLog.length).toEqual(0); }); });
which checks that the browser console is empty (there are no errors on the console).
Problem : when I run this specification in Internet Explorer, I get an UnknownError :
UnknownError: command not found: POST / session / 6b838fe8-f4a6-4b31-b245-f4bf8f37537c / log
After a quick research, I found that IE selenium webdriver does not yet support session logs:
Question: how can I catch this UnknownError and pass the specification pass in case of this particular error?
Or, to enable it, is it possible to be able to block the afterEach() / browser-specific block, or to know which one is currently working?
I tried using try/catch and try to rely on the sender exception, but console.log() fails:
afterEach(function() { try { browser.manage().logs().get("browser").then(function (browserLog) { expect(browserLog.length).toEqual(0); }); } catch (e) { console.log(e.sender); } });
As a workaround, I duplicate the same specification, but without this afterEach() block, especially for Internet Explorer.