Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Safari driver errors on setTimeout because of JSON Wire protocol keys #168

Closed
platosha opened this issue Jan 24, 2019 · 1 comment
Closed
Assignees
Labels

Comments

@platosha
Copy link

When running WebDriver tests with desktop Safari 12 on SauceLabs, I’m getting this error whenever there is a setTimeout or pollUntil used:

Suite Safari on macOS - starter application - index page FAILED                                                                                                           
InvalidArgument: [POST http://(redacted)@localhost:4444/wd/hub/session/[id]/timeouts / {"type":"script","ms":30000,"script":30000}] Unknown timeout type in 'timeouts': 'type' 

It seems that the recent Safari driver requires W3C WebDriver protocol strictly. I cannot find a way to enable the legacy protocol back with SauceLabs.

Looks like Leadfoot can already discover that the server requires WebDriver protocol for timeouts, see:

leadfoot/src/Server.ts

Lines 883 to 898 in c99e15b

if (capabilities.usesWebDriverTimeouts == null) {
testedCapabilities.usesWebDriverTimeouts = () => {
// setFindTimeout uses JSON wire protocol by default, and will fail
// if the server is using W3C WebDriver
return session.setFindTimeout(500).then(
unsupported,
error =>
// At least Chrome 60+
/Missing 'type' parameter/.test(error.message) ||
// At least Safari 10+
/Unknown timeout type/.test(error.message) ||
// IE11
/Invalid timeout type specified/.test(error.message)
);
};
}
, but still the session.setTimeout API sends both JSON Wire and WebDriver data at the same time regardless of the detected requirement:

leadfoot/src/Session.ts

Lines 222 to 229 in c99e15b

// Set both JSONWireProtocol and WebDriver properties in the data object
let data = {
type,
ms,
[type === 'page load' ? 'pageLoad' : type]: ms
};
const promise = this.serverPost<void>('timeouts', data).catch(error => {

@jason0x43 jason0x43 added the bug label Jan 24, 2019
@jason0x43
Copy link
Member

D'oh. Sending both types of data was, apparently for just a short time, a more efficient way to handle timeouts than doing the feature test. That didn't last long.

@jason0x43 jason0x43 self-assigned this Feb 4, 2019
jason0x43 added a commit that referenced this issue Feb 21, 2019
- Work around Safari's incorrect handling of visible text
- Skip /displayed tests for WebDriver remotes
- Move some checks from feature detection to error recovery
- Improve browser and platform detection from capabilities

fixes #168
fixes #165
fixes #161
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants