Skip to content
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

Closed
starcwl opened this issue Jun 15, 2018 · 8 comments
Closed

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

starcwl opened this issue Jun 15, 2018 · 8 comments
Labels

Comments

@starcwl
Copy link

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?

@tonyaveniros
Copy link

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
Copy link

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
Copy link

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

@Alvassp
Copy link

Alvassp commented Nov 21, 2018

Hello, could you please help me, I have the same problem, when perform tests (selenium/c#/Safari 12).
I've catch:
Request body does not contain required parameter 'handle'

Current window:page-6CF4B0C0-1AD6-43A0-8E64-2F9EC720E260 New window:page-6CF4B0C0-1AD6-43A0-8E64-2F9EC720E260 error:
Request body does not contain required parameter 'handle'.
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'itako39021.prod.miso', ip: 'fe80:0:0:0:1093:5dbf:b722:61c9%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '9.0.4'
Driver info: driver.version: unknownRequest body does not contain required parameter 'handle'.
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'itako39021.prod.miso', ip: 'fe80:0:0:0:1093:5dbf:b722:61c9%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '9.0.4'
Driver info: driver.version: unknownOpenQA.Selenium.WebDriverException:
Request body does not contain required parameter 'handle'.
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z' System info: host: 'itako39021.prod.miso', ip: 'fe80:0:0:0:1093:5dbf:b722:61c9%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '9.0.4' Driver info: driver.version: unknown at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteTargetLocator.Window(String windowHandleOrName) at ServiceChannel.Specflow.Support.PageObjectBase.SwitchTab() in D:\Work\Project1\ServiceClick\ServiceChannel.Specflow\Support\PageObjectBase.cs:line 168 at ServiceChannel.Specflow.ServiceClick.Steps.ClickOnAllMenuItemsSteps.WhenTheUserSwitches(String type) in D:\Work\Project1\ServiceClick\ServiceChannel.Specflow\ServiceClick\Platform\Steps\ClickOnAllMenuItemsSteps.cs:line 73 at lambda_method(Closure , IContextManager , String ) at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors() at ServiceChannel.Specflow.ServiceClick.Proposals.Features.CreateProposalFeature.ScenarioCleanup() at ServiceChannel.Specflow.ServiceClick.Proposals.Features.CreateProposalFeature.CreateProposalByProvider() in D:\Work\Project1\ServiceClick\ServiceChannel.Specflow\ServiceClick\Proposals\Features\CreateProposal.feature:line 102 at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.ExecuteInternal(ITestThreadExecutionContext testThreadExecutionContext) at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.Execute(ITestThreadExecutionContext testThreadExecutionContext) at TechTalk.SpecRun.Framework.TestAssemblyExecutor.ExecuteTestNodeTask(TestNode testNode, ITaskExecutor task, TraceEventType eventType)

@AlexSdet
Copy link

AlexSdet commented Feb 27, 2019

Issue still happening for me when using '--legacy' flag

OS: OSX High Sierra
Safari: 12.0.3
Ruby: 2.3.3
Selenium: 3.4.0
Using 'Capybara' framework with selenium webdriver.

Add argument like suggested above:
still_issue

But still seeing an issue:
Request body does not contain required parameter 'capabilities'.
/Users/username/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/response.rb:69

Any ideas what im doing wrong ?

Thanks

@cgoldberg
Copy link
Contributor

Any ideas what im doing wrong ?

update selenium-webdriver to the latest version. 3.4.0 is almost 2 years old and you will need a newer version that uses the (W3C) webdriver protocol.

@philipwalton
Copy link

Looks like the fix suggested here is no longer working in Safari 12.1: #6431 (comment)

@shs96c
Copy link
Member

shs96c commented Apr 4, 2019

The only reason the SeleniumJS 4 bindings are not marked as production ready is because we've yet to release Selenium 4 itself. We'll update the name of the bindings and push them to npm soon.

@shs96c shs96c closed this as completed Apr 4, 2019
@lock lock bot locked and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants