New issue

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

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

Already on GitHub? Sign in to your account

Request body does not contain required parameter 'capabilities'. #6026

Open
starcwl opened this Issue Jun 15, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@starcwl

starcwl commented Jun 15, 2018

Meta -

OS: 10.13.4 OSX

Selenium Version: 3.6

Browser: safari

I want to use safari technology preview instead of safari

Browser Version: STP 58

Expected Behavior -

Actual Behavior -

SessionNotCreatedError: Request body does not contain required parameter 'capabilities'.
at Object.throwDecodedError (/Users/starcwl/Documents/Project/ZiJing/Web/automation/node_modules/selenium-webdriver/lib/error.js:514:15)
at parseHttpResponse (/Users/starcwl/Documents/Project/ZiJing/Web/automation/node_modules/selenium-webdriver/lib/http.js:519:13)
at doSend.then.response (/Users/starcwl/Documents/Project/ZiJing/Web/automation/node_modules/selenium-webdriver/lib/http.js:441:30)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
at Function.createSession (/Users/starcwl/Documents/Project/ZiJing/Web/automation/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
at Function.createSession (/Users/starcwl/Documents/Project/ZiJing/Web/automation/node_modules/selenium-webdriver/safari.js:253:41)
at createDriver (/Users/starcwl/Documents/Project/ZiJing/Web/automation/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/Users/starcwl/Documents/Project/ZiJing/Web/automation/node_modules/selenium-webdriver/index.js:660:16)
at Object. (/Users/starcwl/Documents/Project/ZiJing/Web/automation/test.js:6:54)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

Steps to reproduce -

let wd = require('selenium-webdriver');
let safari = require('selenium-webdriver/safari');
let opts = new safari.Options();
opts.setTechnologyPreview(true);
let caps = opts.toCapabilities();
let driver = new wd.Builder().withCapabilities(caps).build(); 

so how could I contain capabilities in request body?

@barancev barancev added the C-nodejs label Jun 19, 2018

@tonyaveniros

This comment has been minimized.

Show comment
Hide comment
@tonyaveniros

tonyaveniros Sep 19, 2018

I just upgraded to Safari 12 and now all my Selenium / WebDriver tests are failing with the error.
SessionNotCreatedError: Request body does not contain required parameter 'capabilities'.

Which is peculiar because I have defined capabilities.

High Sierra 10.13.6 (17G65) with Safari Version 12.0 (13606.2.11)

tonyaveniros commented Sep 19, 2018

I just upgraded to Safari 12 and now all my Selenium / WebDriver tests are failing with the error.
SessionNotCreatedError: Request body does not contain required parameter 'capabilities'.

Which is peculiar because I have defined capabilities.

High Sierra 10.13.6 (17G65) with Safari Version 12.0 (13606.2.11)

@mjdease

This comment has been minimized.

Show comment
Hide comment
@mjdease

mjdease Sep 21, 2018

This issue happens because Safari 12 uses a new (W3C) webdriver protocol which appears incompatible with selenium-webdriver v3.6

safaridriver can be passed a --legacy flag to use the old protocol.

I got this working in my project with the following:

const webdriver = require('selenium-webdriver');
const safari = require('selenium-webdriver/safari');

new webdriver.Builder()
    .usingServer(await new safari.ServiceBuilder().addArguments('--legacy').build().start())
    .forBrowser('safari')
    .build();

More details in #6431

Edit: pinging @jleyba FYI it appears the latest stable version of the node package doesn't work by default with Safari 12 which is now generally available.

mjdease commented Sep 21, 2018

This issue happens because Safari 12 uses a new (W3C) webdriver protocol which appears incompatible with selenium-webdriver v3.6

safaridriver can be passed a --legacy flag to use the old protocol.

I got this working in my project with the following:

const webdriver = require('selenium-webdriver');
const safari = require('selenium-webdriver/safari');

new webdriver.Builder()
    .usingServer(await new safari.ServiceBuilder().addArguments('--legacy').build().start())
    .forBrowser('safari')
    .build();

More details in #6431

Edit: pinging @jleyba FYI it appears the latest stable version of the node package doesn't work by default with Safari 12 which is now generally available.

@tonyaveniros

This comment has been minimized.

Show comment
Hide comment
@tonyaveniros

tonyaveniros Sep 21, 2018

For me, it was choking on the 'await', but this works:

new webdriver.Builder()
    .usingServer( new safari.ServiceBuilder().addArguments('--legacy').build().start())
    .forBrowser('safari')
    .build();

using node v8.12.0

tonyaveniros commented Sep 21, 2018

For me, it was choking on the 'await', but this works:

new webdriver.Builder()
    .usingServer( new safari.ServiceBuilder().addArguments('--legacy').build().start())
    .forBrowser('safari')
    .build();

using node v8.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment