javascript - Node.js selenium webdriver - Get browser capabilities inside test? -
i'm using selenium webdriver on node.js (currently via webdriverio, don't mind switching webdriverjs or wd).
i run tests on different browsers , want save results of each test along information browser, example:
- test 1 - chrome - 199 assertions, 0 failures, 0 skipped
- test 1 - ie9 - 199 assertions, 0 failures, 0 skipped
- etc..
how can "desiredcapabilities" object within test?
or how can pass test available?
edit
i found browser.desiredcapabilities
returns requested capabilities object, realize need "actual capabilities" used (for example if ask ie8 on machine has ie11 ie11 desiredcapabilities object shows version=8).
i'm looking way actual used browser capabilities, documented on selenium wiki:
if session cannot support capability requested in desired capabilities, no error thrown; read-only capabilities object returned indicates capabilities session supports.
using webdriverjs (which mentioned switch to), can use getcapabilities
:
browser.getcapabilities().then(function (caps) { console.log(caps); });
the code above dump capabilities should use methods of capabilities
class inspect values. instance:
browser.getcapabilities().then(function (caps) { console.log(caps.get("browsername"), caps.get("version")); });
Comments
Post a Comment