I tried to run my tests at SauceLabs, but had an invalid API key. The SauceLabs API responded with the following body:
You used username 'derhuerst' and access key '1a04c633-6a58-1234-8287-43ecc070' to authenticate, which are not valid Sauce Labs credentials.
The following desired capabilities were received:
{'browserName': 'Chrome',
'javascriptEnabled': True,
'platform': 'Windows 10',
'recordVideo': False,
'version': ''}
Two issues in combination cause the wd not to handle this correctly:
httpUtils.requestWithRetry doesn't create an error if the HTTP status code is !== 2xx. Instead it just passes null as the error and the HTTP body as data.
Instead of calling the callback with the error from SauceLabs, wd will choke and throw an uncaught error TypeError: Cannot read property 'value' of undefined.
The full stack trace:
TypeError: Cannot read property 'value' of undefined
at /Users/j/web/fs-read-stream-over-http/node_modules/wd/lib/webdriver.js:134:85
at Request._callback (/Users/j/web/fs-read-stream-over-http/node_modules/wd/lib/http-utils.js:88:7)
at Request.self.callback (/Users/j/web/fs-read-stream-over-http/node_modules/wd/node_modules/request/request.js:186:22)
at Request.emit (events.js:160:13)
at Request.<anonymous> (/Users/j/web/fs-read-stream-over-http/node_modules/wd/node_modules/request/request.js:1081:10)
at Request.emit (events.js:160:13)
at IncomingMessage.<anonymous> (/Users/j/web/fs-read-stream-over-http/node_modules/wd/node_modules/request/request.js:1001:12)
at Object.onceWrapper (events.js:255:19)
at IncomingMessage.emit (events.js:165:20)
at endReadableNT (_stream_readable.js:1101:12)
I tried to run my tests at SauceLabs, but had an invalid API key. The SauceLabs API responded with the following body:
Two issues in combination cause the
wd
not to handle this correctly:httpUtils.requestWithRetry
doesn't create an error if the HTTP status code is !== 2xx. Instead it just passesnull
as the error and the HTTP body asdata
.Webdriver.prototype._init
tries to accessjsonData.value
even thoughjsonData
might beundefined
at that point.Instead of calling the callback with the error from SauceLabs,
wd
will choke and throw an uncaught errorTypeError: Cannot read property 'value' of undefined
.The full stack trace: