Edit this Doc The Safari Driver
Safari driver has been added to Appium since version 1.20. This driver is a wrapper over Apple's safaridriver binary, which is included to the standard macOS distribution and implements communication with either desktop or mobile Safari browser via W3C WebDriver protocol.
Development of the Safari driver happens at the appium-safari-driver repo.
Appium also supports mobile Safari automation and Safari web views automation using the
appium-remote-debugger. This module is
used to implement context switching feature with XCUITest automation name. It is more universal
and flexible than the current Safari driver, however it is using the undocumented WebKit communication
protocol under the hood. Which means the development of it and the effort to keep it in working state
is comparably high while the list of supported features is smaller. On the other hand
is maintained by Apple, which means it is always in sync with the most recent browser
and communication protocol requirements.
Long story short, it makes sense to prefer this driver if it is necessary to only automate a web application that only works in Safari browser (either mobile or desktop). In case it is necessary to interact with native context or switch between different applications/contexts while automating your scenario then the obvious choice would be either XCUITest Driver (for the mobile platform) or Mac driver (for the desktop platform).
Requirements and Support
In addition to Appium's general requirements:
- Run the
safaridriver --enablecommand from the macOS terminal and provide your administrator password before any automated session will be executed. This only should be done once.
- In order to automate Safari on real devices it is necessary to enable Remote Automation switch in
Settings → Safari → Advanced → Remote Automationfor these particular devices and trust them on the target host. The device's screen must not be locked while starting tests.
- Only macOS (High Sierra or newer) is supported as the host platform.
- Only iOS 13 and newer is supported for mobile browser automation. As it is stated in the WebKit blog article, Safari for iOS does not allow WebDriver-initiated navigations to be handled outside of Safari. In other words, clicking a tel:// link will not offer to place a phone call, and clicking an app store link will not redirect the user to the App Store. Similarly, non-Safari content displayed by the system–such as update dialogs, app notifications, incoming calls, etc.–are suppressed while a WebDriver session is active.
The way to start a session using the Safari driver is to include the
automationName capability in your new session request, with
Safari. Of course, you must also include appropriate
The list of available driver capabilities could be found at https://github.com/appium/appium-safari-driver/blob/master/README.md