webdriverio无法满足设置cookie值的请求

时间:2017-04-28 08:54:21

标签: cookies webdriver phantomjs

这是我的代码,我想设置cookie,但是我收到如下所示的错误消息。

 await browser.url(`http://xxx.xxx.com`);
 await browser.setCookie({
  name: 'myCookie',
  value: '12sdfdsfsdfsfddsf3',
  domain: 'xxx.xxx.com',
  path: '/',                /* required property */
  httponly : true,
  secure   : false,
  expires  : (new Date()).getTime() + (1000 * 60 * 60)
});

这是错误消息

Unable to set Cookie
running phantomjs
Error: A request to set a cookie's value could not be satisfied.
at cookie("post", [object Object]) - index.js:348:27
at url("http://xxx.xxx.com") - index.js:307:3

这是配置

{
 capabilities: [
  {
    browserName: 'phantomjs',
  }
 ],
 exclude: [],
 maxInstances: 2,
 sync: true,
 logLevel: 'error',
 coloredLogs: true,
 waitforTimeout: 20000,
 connectionRetryTimeout: 50000,
 connectionRetryCount: 3,
 screenshotPath: './errorShots/',
 screenshotOnReject: true,
 framework: 'mocha',
 reporters: [costomReport],
 reporterOptions: {
  outputDir: './',
  combined: true
 },
 mochaOpts: {
  ui: 'bdd',
  timeout: 30000,
 }
}

我尝试过使用browser.cookie(" post",[{...}]),但它也不起作用。 有什么建议吗?

0 个答案:

没有答案