I’ve never personally found the return on investment of getting automated tests running across Internet Explorer and Safari to be worthwhile as in my experience this took more effort than the bugs it found. So I personally stick to running our full e2e test suite in our most used browser (Chrome) and supplementing this with exploratory testing on all other browsers.
In saying that the reason you won’t be able to use Docker containers for these purposes is that they’re Linux and Internet Explorer requires Microsoft Windows and Safari requires Apple macOS to be able to run. To be able to use these for your existing automated tests you can sign up to a on-demand browser service like SauceLabs and use the remote WebDriver protocol to execute your tests.
Well, it’s official: Watir-WebDriver now supports Safari thanks to the release of SafariDriver.
The downside is the set up is quite lengthy at the moment as it requires a Safari extension (version 5+) and until someone publishes the extension to the online gallery, you’ll have to build it yourself.
Steps to build the extension
- First, create and install a Safari extension certificate at Apple. You’ll need to sign up for a (free) Safari developer account, and download your certificate locally.
- Now, you’ll need to build the extension. First, you’ll need to check out the selenium source code to do so:
svn co http://selenium.googlecode.com/svn/trunk selenium
- Then change into this directory and build the extension
- Finally, install your extension:
- Launch Safari
- Ensure develop menu is shown by setting it in Advanced Preferences
- Open the Extension Builder (Develop > Show Extension Builder)
- Add your new extension from:
Using Safari with Watir-WebDriver
It’s exactly the same as any other browser:
b = Watir::Browser.new :safari
- browser.execute_script is a little flakey
- Can’t use local html files as extensions don’t load
- Not sure how to configure browser options programatically like user agent strings