Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Let v4 support w3c drivers #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions lib/protocol/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,40 @@ export default function init (desiredCapabilities = {}) {
}
})

return this.requestHandler.create({
path: '/session',
method: 'POST'
}, {
desiredCapabilities: this.desiredCapabilities
})
const jsonwpCaps = this.desiredCapabilities;
const w3cCapKeys = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't match what exists in webdriver v5:
https://github.com/webdriverio/webdriverio/blob/e79328564e049fe6c81f0319ffe89d9293462e69/packages/webdriverio/src/constants.js#L369

looking at goog:chromeOptions and moz:firefoxOptions

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"browserName",
"browserVersion",
"platformName",
"acceptInsecureCerts",
"pageLoadStrategy",
"proxy",
"setWindowRect",
"timeouts",
"strictFileInteractability",
"unhandledPromptBehavior",
"goog:chromeOptions",
"moz:firefoxOptions"
];
const w3cCapsAlwaysMatch = {};
w3cCapKeys.forEach(key => {
if (jsonwpCaps[key]) {
w3cCapsAlwaysMatch[key] = jsonwpCaps[key];
}
});
const w3cCaps = {
alwaysMatch: w3cCapsAlwaysMatch,
firstMatch: [{}]
};

return this.requestHandler.create(
{
path: "/session",
method: "POST"
},
{
desiredCapabilities: jsonwpCaps,
capabilities: w3cCaps
}
);
}