Failed to connect to SafariDriver (Safari 10)

后端 未结 2 834
小蘑菇
小蘑菇 2021-01-02 23:48

I\'m getting the following error when running my protractor test on mac for safari

Failed to connect to SafariDriver after 10082 ms
Build info: version: \'2.         


        
2条回答
  •  醉酒成梦
    2021-01-03 00:38

    First of all, starting with Safari 10, Safari comes bundled with a new driver implementation. The old driver (the extension) is deprecated. You're using macOS 10.12.2, so it's your case. To enable the new driver in Safari, toggle the Allow Remote Automation checkbox in the Develop menu. If you don't have this menu, enable it: Preferences > Advanced > Show Develop menu in menu bar. Start /usr/bin/safaridriver once manually to grant it the permissions needed.

    Secondly, you need a 3.x version of the Selenium Standalone Server, not 2.53.1. The command to install it:

    sudo webdriver-manager update --versions.standalone 3.0.1
    

    To start:

    webdriver-manager start --versions.standalone 3.0.1
    

    Thirdly, the visibility checks are broken in the new driver. So things like browser.wait(ExpectedConditions.visibilityOf(myElement), 5000); don't work and lead to UnsupportedCommandException. In order to fix this, you can try installing Safari Technology Preview and running tests there (add 'safari.options': { technologyPreview: true } to the capabilities). But for me, the preview works even worse than the release. Protractor says it can't find Angular on the page because they changed window.name to be cleared after a cross-origin navigation in the Release 19. If you happen to find a way to make it work, please let me know.

    Below are some links you should check because I might have missed something.

    • The blog post that announces the new driver in Safari 10
    • Issues in the Protractor project:
      • Safari 10 failing with the latest protractor
      • Safari Technology Preview can't find Angular 1

提交回复
热议问题