如何使用ucelabs(Selenium,behat3.0貂皮)功能自定义屏幕分辨率 [英] How to customize screen resolution with saucelabs (selenium, behat3.0 mink) capabilities

查看:52
本文介绍了如何使用ucelabs(Selenium,behat3.0貂皮)功能自定义屏幕分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的behat.yml文件:

This is my behat.yml file :

firefox:                  
 suites:  
    firefox:  
      contexts:  
        -FeatureContext
  extensions:  
    Behat\MinkExtension:
      javascript_session: selenium2
      base_url: https://example.com
      selenium2:
        wd_host: username:pwd@ondemand.saucelabs.com/wd/hub
        browser: firefox
        capabilities: {'platform':'OS X 10.10', 'browser':'firefox', 'version':'42.0', "screen-resolution":"1280x1024"}

给出错误"

[Symfony \ Component \ Config \ Definition \ Exception \ InvalidConfigurationException]
"testwork.mink.sessions.selenium2.selenium2.capabilities"下的无法识别的选项屏幕分辨率"

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized option "screen-resolution" under "testwork.mink.sessions.selenium2.selenium2.capabilities"

我已经尝试过了 https://groups.google.com/forum/#!topic/behat/kApbLIiAkOg,但我也遇到了完全相同的错误.

I have tried this https://groups.google.com/forum/#!topic/behat/kApbLIiAkOg, but I am also getting exactly same error.

如果我配置了SauceLabsDriver,那么只有我将得到全部( https://github.com/Behat/MinkExtension/blob/master/doc/index.rst#sessions )-Selenium2Driver的特殊风格

If I configure SauceLabsDriver then only I will get all (https://github.com/Behat/MinkExtension/blob/master/doc/index.rst#sessions) - special flavor of the Selenium2Driver

以上文件建议修改您的behat.yml个人资料:

The above document is suggesting modify your behat.yml profile:

default:
    extensions:
        Behat\MinkExtension:
            sessions:
                my_session:
                    sauce_labs: ~

但是不知道如何实现这一点.任何想法?如何使用ucelabs更改behat.yml文件以使用所有这些自定义参数.

But no idea how to implementing this. Any idea? How to change behat.yml file with saucelabs to use all those customization parameters.

推荐答案

尽管这是针对behat 2的,您能否尝试

Although this is for behat 2, could you please try Resizing browser window size with behat2.

class FeatureContext extends MinkContext
{
    /**
     * @BeforeScenario
     */
    public function resizeWindow()
    {
        $this->getSession()->resizeWindow(1440, 900, 'current');
    }
}

这篇关于如何使用ucelabs(Selenium,behat3.0貂皮)功能自定义屏幕分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆