How to set window size for Safari browser running codeception / selenium 3.3.1

时间:2017-04-06 16:59:39

标签: selenium safari codeception

Working on upgrading our Codeception acceptance test suite from Selenium 2.53.1 to Selenium 3.3.1. When running on Selenium 3.3.1, our Webdriver option of window_size: seems to have no effect.

  • I've tried using 'maximum'. This leads to the test running on a window maybe a third of the size of my approximately 1420 x 700 screen.

  • I've tried using a specific size '1400 x 600'. This leads to an error "A request to use a window could not be satisfied because the window could not be found."

  • When tests are run with window_size removed they run in the same size window as when it is set to 'maximum'.

Our normal, maximum, continues to work for Firefox and Chrome on Max OSX Sierra when run with selenium server 2.53.1 or 3.3.1. Safari bit from acceptance.suite.yml:

env:
    safari:
         modules:
            config:
                WebDriver:
                    browser: 'safari'
                    window_size: 'maximum'
                    clear_cookies: true
                    restart: true
                    options:
                        cleanSession: true

I note there is another unanswered question on Stack Overflow referencing a similar error running selenium 3.0.1 with no answer Selenium 3.0.1 - Safari 10 Webdriver - NoSuchWindowException after setPosition.

2 个答案:

答案 0 :(得分:1)

啊我有类似的问题,这是一个已知的缺陷,对于safari和safari技术预览:我引用:

Selenium 3.1.0 Safari 10.0.3或Safari预览版V25 UnsupportedCommandException for显示为NOT FIXED 并且最大化不起作用,肯定会有更多

答案 1 :(得分:0)

Safari 11与Selenium 3.5.3此问题已得到解决。简单地包括window_size:'最大化'再次工作。