如何在Webdriverio配置文件中配置Chrome驱动程序并设置浏览器窗口大小/视口大小

时间:2020-06-19 13:21:02

标签: webdriver-io

我想设置Chrome驱动程序并设置功能以在与webdriverio工具一起使用的配置文件中打开特定的视口宽度X高度。我想要铬的功能选项,以便测试将从该配置开始。

我尝试了以下操作,但工作不正常

我正在使用webdriverIO v5

1 个答案:

答案 0 :(得分:0)

browser.setWindowSize(1800, 2000); // <-- this command 

选中documentation

如果您想在测试之前将其添加到wdio.conf.js中,则可以将其添加到

  /**
   * Gets executed before test execution begins. At this point you can access to all global
   * variables like `browser`. It is the perfect place to define custom commands.
   * @param {Array.<Object>} capabilities list of capabilities details
   * @param {Array.<String>} specs List of spec file paths that are to be run
   */
  // before: function (capabilities, specs) {
  // },