webdriverio: nullPointerException in firefox when calling setValue

Environment (please complete the following information):

Config of WebdriverIO Repo to reproduce the issue: https://github.com/hborawski/wdio-sauce-junit-error

Describe the bug When using setValue in saucelabs firefox environment, a null pointer exception is thrown and the value is never set. (Observed in firefox 59-66, did not test earlier versions)

Error: java.lang.NullPointerException
     at getErrorFromResponseBody (/Users/hborawski/sandbox/wdio-sauce-nullpointer/node_modules/webdriver/build/utils.js:348:10)
     at Request._callback (/Users/hborawski/sandbox/wdio-sauce-nullpointer/node_modules/webdriver/build/request.js:121:64)
     at Request.self.callback (/Users/hborawski/sandbox/wdio-sauce-nullpointer/node_modules/request/request.js:185:22)
     at Request.emit (events.js:182:13)
     at Request.EventEmitter.emit (domain.js:441:20)
     at Request.<anonymous> (/Users/hborawski/sandbox/wdio-sauce-nullpointer/node_modules/request/request.js:1161:10)
     at Request.emit (events.js:182:13)
     at Request.EventEmitter.emit (domain.js:441:20)
     at IncomingMessage.<anonymous> (/Users/hborawski/sandbox/wdio-sauce-nullpointer/node_modules/request/request.js:1083:12)
     at Object.onceWrapper (events.js:273:13)

To Reproduce Steps to reproduce the behavior in README.md: https://github.com/hborawski/wdio-sauce-nullpointer

Expected behavior Test should pass and exit with exit code 0

Log https://gist.github.com/hborawski/a8536a3ebb97240005e0eb5bae993d37

Notes I found this issue: https://github.com/webdriverio/webdriverio/issues/3844 that looks to be the same problem but was closed as a duplicate of https://github.com/webdriverio/webdriverio/issues/3834 which seems to be unrelated. In either case, this was reproduced with the newest versions which includes the fix for the log type error from https://github.com/webdriverio/webdriverio/issues/3834

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (18 by maintainers)

Most upvoted comments

This is the complete set that currently works for Sauce Labs and WDIO

const deskSpecs = join(process.cwd(), './tests/specs/desktop.spec.js');
const defaultBrowserSauceOptions = {
    screenResolution: '1600x1200',
    seleniumVersion: '3.141.59',
};
const chromeOptions = {
    'goog:chromeOptions': {
        'w3c': true,
    },
};

config.capabilities= [
   /**
     * Desktop browsers
     */
    {
        browserName: 'googlechrome',
        platformName: 'Windows 10',
        browserVersion: 'latest',
        specs: [ basicSpecs ],
        'sauce:options': {
            ...defaultBrowserSauceOptions,
        },
        ...chromeOptions,
    },
    {
        browserName: 'googlechrome',
        platformName: 'Windows 10',
        browserVersion: 'latest',
        specs: [ deskSpecs ],
        'sauce:options': {
            ...defaultBrowserSauceOptions,
        },
        ...chromeOptions,
    },
    {
        browserName: 'firefox',
        platformName: 'Windows 10',
        browserVersion: 'latest',
        specs: [ deskSpecs ],
        'sauce:options': {
            ...defaultBrowserSauceOptions,
        },
    },
    {
        browserName: 'internet explorer',
        platformName: 'Windows 8.1',
        browserVersion: 'latest',
        specs: [ deskSpecs ],
        'sauce:options': {
            ...defaultBrowserSauceOptions,
            iedriverVersion: '3.141.59',
        },
    },
    {
        browserName: 'MicrosoftEdge',
        platformName: 'Windows 10',
        browserVersion: 'latest',
        specs: [ deskSpecs ],
        'sauce:options': {
            ...defaultBrowserSauceOptions,
        },
    },
    // Safari 11 is not W3C compliant,
    // see https://developer.apple.com/documentation/webkit/macos_webdriver_commands_for_safari_11_1_and_earlier
    {
        browserName: 'safari',
        platform: 'macOS 10.12',
        version: '11.0',
        specs: [ deskSpecs ],
        ...defaultBrowserSauceOptions,
    },
    {
        browserName: 'safari',
        platformName: 'macOS 10.14',
        browserVersion: '12.0',
        specs: [ deskSpecs ],
        'sauce:options': {
            ...defaultBrowserSauceOptions,
        },
    }
];

The problem is that WebdriverIO is already using W3C but the Sauce Labs platform not. By providing the 'sauce:options' and the new properties, see here all should work

Does that mean that WebdriverIO will also change the rest of the capabilities?

I actually don’t know. I don’t believe it is fixed anytime soon on the Sauce side so I believe maybe moving it into the sauce service would make most sense 🤷‍♂ ?

So imo we should add

const sauceOptions = {
  'sauce:options': {
    seleniumVersion: '3.141.59',
    build: `Build ${Date.now()}`.slice(0, -3)
  }
}

const chromeOptions = {
  'goog:chromeOptions': {
    'w3c': true
  }
}

automatically to the capabilities if someone is running tests on Sauce.

@wswebcreation I would almost say let’s add this for all SL jobs as default options. I don’t see a reason why someone would not like to use W3C sessions.

@wswebcreation would it be useful to pin somewhere in wdio docs?