colin_dev256 colin_dev256 - 3 months ago 8x
Node.js Question

Detecting browser with protractor

Is there a way to detect the browser testing my scripts in protractor? Looked everywhere! I'm trying to factor all my different browser specs into one each so that in the config file I simply change the browser name and execute the same script. I've already tried these;

if (isFirefox)

if (browser === 'firefox')


As far as I know you set the browser through the capabilities object right?

You can get the browser that you set here in your test script with

browser.getCapabilities().then(function (capabilities) {
  browser.browserName = capabilities.caps_.browserName;

Now just check this variable.