请求主体不包含所需的参数“手柄”(Request body does not contain req

2019-09-28 07:19发布

请你帮我,我有问题,进行测试时,在虚拟机(C#/ Safari的12 / MacOS的10.13)。

Selenium.Support: version=3.141.0
Selenium.WebDriver version=3.141.0
SpecFlow version="2.1.0

我有陷阱:

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)

同样的话题早已存在

Answer 1:

您的问题,采用了全新的webdriver协议是由于Safari浏览器12。 这是造成一些incompatabilty问题。 问题在这里已经报道: https://github.com/SeleniumHQ/selenium/issues/6026

你可以通过safaridriver一个--legacy标志,该标志被张贴mjdease上的旧协议https://github.com/SeleniumHQ/selenium/issues/6026

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();


文章来源: Request body does not contain required parameter 'handle'