appium-safari-driver 5.0.3 → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +26 -142
- package/npm-shrinkwrap.json +893 -83
- package/package.json +33 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [5.0.4](https://github.com/appium/appium-safari-driver/compare/v5.0.3...v5.0.4) (2026-07-01)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* downgrade conventional-changelog-conventionalcommits to v9 ([#177](https://github.com/appium/appium-safari-driver/issues/177)) ([336c322](https://github.com/appium/appium-safari-driver/commit/336c322b7af7ea3978914c38ffd4549579a99439))
|
|
6
|
+
|
|
1
7
|
## [5.0.3](https://github.com/appium/appium-safari-driver/compare/v5.0.2...v5.0.3) (2026-06-29)
|
|
2
8
|
|
|
3
9
|
## [5.0.2](https://github.com/appium/appium-safari-driver/compare/v5.0.1...v5.0.2) (2026-06-19)
|
package/README.md
CHANGED
|
@@ -1,155 +1,39 @@
|
|
|
1
|
-
Appium Safari Driver
|
|
2
|
-
|
|
1
|
+
## Appium Safari Driver
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://appium.github.io/appium-safari-driver/">
|
|
5
|
+
<picture>
|
|
6
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/assets/images/appium-plus-safari-light.png">
|
|
7
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/images/appium-plus-safari-dark.png">
|
|
8
|
+
<img width="400" alt="Appium Safari Driver">
|
|
9
|
+
</picture>
|
|
10
|
+
</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<div align="center">
|
|
3
14
|
|
|
4
15
|
[](https://npmjs.org/package/appium-safari-driver)
|
|
5
16
|
[](https://npmjs.org/package/appium-safari-driver)
|
|
6
|
-
|
|
7
17
|
[](https://github.com/appium/appium-safari-driver/actions/workflows/publish.js.yml)
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
The driver only supports Safari automation using [W3C WebDriver protocol](https://www.w3.org/TR/webdriver/).
|
|
11
|
-
Under the hood this driver is a wrapper/proxy over Apple's `safaridriver` binary. Check the output of `man safaridriver` command to get more details on the supported features and possible pitfalls.
|
|
12
|
-
|
|
13
|
-
> [!IMPORTANT]
|
|
14
|
-
> Since major version *4.0.0*, this driver is only compatible with Appium 3. Use the `appium driver install safari`
|
|
15
|
-
> command to add it to your distribution.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
It is mandatory to run the `safaridriver --enable` command from the macOS terminal and provide your administrator password before any automated session will be executed.
|
|
21
|
-
In order to automate Safari on real devices it is also necessary to enable Remote Automation switch in `Settings → Safari → Advanced → Remote Automation` for these particular devices.
|
|
22
|
-
|
|
23
|
-
Then you need to decide where the automated test is going to be executed. Safari driver supports the following target platforms:
|
|
24
|
-
- macOS (High Sierra or newer)
|
|
25
|
-
- iOS Simulator (iOS version 13 or newer)
|
|
26
|
-
- iOS Real Device (iOS version 13 or newer)
|
|
27
|
-
|
|
28
|
-
Safari driver allows to define multiple criterions for platform selection and also to fine-tune your automation session properties. This could be done via the following session capabilities:
|
|
29
|
-
|
|
30
|
-
Capability Name | Description
|
|
31
|
-
--- | ---
|
|
32
|
-
platformName | safaridriver binary can only create WebDriver sessions for desktop or mobile Safari and can only run on macOS. Value of platformName could equal to 'Mac' or 'iOS' in order to start Safari driver session for the corresponding platform. Values of platformName are compared case-insensitively.
|
|
33
|
-
automationName | Value of automationName must equal to 'Safari' in order to start Safari driver session. Values of automationName are compared case-insensitively.
|
|
34
|
-
browserName | safaridriver can only create WebDriver sessions for Safari. Any value passed to this capability will be changed to 'Safari'.
|
|
35
|
-
browserVersion | safaridriver will only create a session using hosts whose Safari version matches the value of browserVersion. Browser version numbers are prefix-matched. For example, if the value of browserVersion is '12', this will allow hosts with a Safari version of '12.0.1' or '12.1'.
|
|
36
|
-
acceptInsecureCerts | Makes the browser to ignore the appropriate security warning and thus allows navigation to web sites having invalid or expired TLS certificates. The capability is supported since safaridriver v15.4.
|
|
37
|
-
safari:platformVersion | safaridriver will only create a session using hosts whose OS version matches the value of safari:platformVersion. OS version numbers are prefix-matched. For example, if the value of safari:platformVersion is '12', this will allow hosts with an OS version of '12.0' or '12.1' but not '10.12'.
|
|
38
|
-
safari:platformBuildVersion | safaridriver will only create a session using hosts whose OS build version matches the value of safari:platformBuildVersion. example of a macOS build version is '18E193'. On macOS, the OS build version can be determined by running the sw_vers(1) utility.
|
|
39
|
-
safari:useSimulator | If the value of safari:useSimulator is true, safaridriver will only use iOS Simulator hosts. If the value of safari:useSimulator is false, safaridriver will not use iOS Simulator hosts. NOTE: An Xcode installation is required in order to run WebDriver tests on iOS Simulator hosts.
|
|
40
|
-
safari:deviceType | If the value of safari:deviceType is 'iPhone', safaridriver will only create a session using an iPhone device or iPhone simulator. If the value of safari:deviceType is 'iPad', safaridriver will only create a session using an iPad device or iPad simulator. Values of safari:deviceType are compared case-insensitively.
|
|
41
|
-
safari:deviceName | safaridriver will only create a session using hosts whose device name matches the value of safari:deviceName. Device names are compared case-insensitively. NOTE: Device names for connected devices are shown in iTunes. If Xcode is installed, device names for connected devices are available via the output of instruments(1) and in the Devices and Simulators window (accessed in Xcode via "Window > Devices and Simulators").
|
|
42
|
-
safari:deviceUDID | safaridriver will only create a session using hosts whose device UDID matches the value of safari:deviceUDID. Device UDIDs are compared case-insensitively. NOTE: If Xcode is installed, UDIDs for connected devices are available via the output of instruments(1) and in the Devices and Simulators window (accessed in Xcode via "Window > Devices and Simulators").
|
|
43
|
-
safari:automaticInspection | This capability instructs Safari to preload the Web Inspector and JavaScript debugger in the background prior to returning a newly-created window. To pause the test's execution in JavaScript and bring up Web Inspector's Debugger tab, you can simply evaluate a debugger; statement in the test page.
|
|
44
|
-
safari:automaticProfiling | This capability instructs Safari to preload the Web Inspector and start a Timeline recording in the background prior to returning a newly-created window. To view the recording, open the Web Inspector through Safari's Develop menu.
|
|
45
|
-
webkit:WebRTC | This capability allows a test to temporarily change Safari's policies for WebRTC and Media Capture. The value of the webkit:WebRTC capability is a dictionary with the following sub-keys, all of which are optional: `DisableInsecureMediaCapture` - Normally, Safari refuses to allow media capture over insecure connections. This restriction is relaxed by default for WebDriver sessions for testing purposes (for example, a test web server not configured for HTTPS). When this capability is specified, Safari will revert to the normal behavior of preventing media capture over insecure connections. `DisableICECandidateFiltering` - To protect a user's privacy, Safari normally filters out WebRTC ICE candidates that correspond to internal network addresses when capture devices are not in use. This capability suppresses ICE candidate filtering so that both internal and external network addresses are always sent as ICE candidates.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## Example
|
|
49
|
-
|
|
50
|
-
```python
|
|
51
|
-
# Python3 + PyTest
|
|
52
|
-
import pytest
|
|
53
|
-
import time
|
|
19
|
+
</div>
|
|
54
20
|
|
|
55
|
-
|
|
56
|
-
# Options are available in Python client since v2.6.0
|
|
57
|
-
from appium.options.ios import SafariOptions
|
|
58
|
-
from selenium.webdriver.common.by import By
|
|
21
|
+
---
|
|
59
22
|
|
|
23
|
+
<p align="center"><b>
|
|
24
|
+
<a href="https://appium.github.io/appium-safari-driver/">Documentation</a> |
|
|
25
|
+
<a href="https://appium.github.io/appium-safari-driver/latest/getting-started/">Get Started</a> |
|
|
26
|
+
<a href="https://github.com/appium/appium-safari-driver/blob/main/CHANGELOG.md">Changelog</a>
|
|
27
|
+
</b></p>
|
|
60
28
|
|
|
61
|
-
|
|
62
|
-
common_caps = {
|
|
63
|
-
# It does not really matter what to put there, although setting 'Safari' might cause a failure
|
|
64
|
-
# depending on the particular client library
|
|
65
|
-
'browserName': 'AppiumSafari',
|
|
66
|
-
}
|
|
67
|
-
real_device_opts = SafariOptions().load_capabilities(common_caps)
|
|
68
|
-
# This is optional
|
|
69
|
-
real_device_opts.device_type = 'iPhone'
|
|
70
|
-
# Do not forget to verify that Remote Automation is enabled for this device
|
|
71
|
-
real_device_opts.device_udid = '<MyDeviceUDID>'
|
|
72
|
-
real_device_opts.use_simulator = False
|
|
29
|
+
---
|
|
73
30
|
|
|
74
|
-
|
|
75
|
-
simulator_opts.platform_version = '14.1'
|
|
76
|
-
simulator_opts.device_name = 'iPad Air 2'
|
|
77
|
-
simulator_opts.use_simulator = True
|
|
31
|
+
This is an Appium driver for automating the Safari browser on macOS, iOS and iPadOS.
|
|
78
32
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
'platformName': 'Mac',
|
|
82
|
-
})
|
|
83
|
-
return [real_device_opts, simulator_opts, desktop_browser_opts]
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
@pytest.fixture(params=generate_options())
|
|
87
|
-
def driver(request):
|
|
88
|
-
# The default URL is http://127.0.0.1:4723/wd/hub in Appium1
|
|
89
|
-
drv = webdriver.Remote('http://127.0.0.1:4723', options=request.param)
|
|
90
|
-
yield drv
|
|
91
|
-
drv.quit()
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
class TimeoutError(Exception):
|
|
95
|
-
pass
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def wait_until_truthy(func, timeout_sec=5.0, interval_sec=0.5):
|
|
99
|
-
started = time.time()
|
|
100
|
-
original_error = None
|
|
101
|
-
while time.time() - started < timeout_sec:
|
|
102
|
-
original_error = None
|
|
103
|
-
try:
|
|
104
|
-
result = func()
|
|
105
|
-
if result:
|
|
106
|
-
return result
|
|
107
|
-
except Exception as e:
|
|
108
|
-
original_error = e
|
|
109
|
-
time.sleep(interval_sec)
|
|
110
|
-
if original_error is None:
|
|
111
|
-
raise TimeoutError(f'Condition unmet after {timeout_sec}s timeout')
|
|
112
|
-
raise original_error
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
def test_feature_status_page_search(driver):
|
|
116
|
-
driver.get('https://webkit.org/status/')
|
|
117
|
-
|
|
118
|
-
# Enter "CSS" into the search box.
|
|
119
|
-
# Ensures that at least one result appears in search
|
|
120
|
-
# !!! Remember there are no ID and NAME locators in W3C standard
|
|
121
|
-
# These two have been superseded by CSS ones
|
|
122
|
-
search_box = driver.find_element_by_css('#search')
|
|
123
|
-
search_box.send_keys('CSS')
|
|
124
|
-
value = search_box.get_attribute('value')
|
|
125
|
-
assert len(value) > 0
|
|
126
|
-
search_box.submit()
|
|
127
|
-
# Count the visible results when filters are applied
|
|
128
|
-
# so one result shows up in at most one filter
|
|
129
|
-
assert wait_until_truthy(lambda: len(driver.execute_script("return document.querySelectorAll('li.feature:not(.is-hidden)')")) > 0)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def test_feature_status_page_filters(driver):
|
|
133
|
-
driver.get('https://webkit.org/status/')
|
|
134
|
-
|
|
135
|
-
assert wait_until_truthy(lambda: len(driver.execute_script("return document.querySelectorAll('.filter-toggle')")) == 7)
|
|
136
|
-
|
|
137
|
-
# Make sure every filter is turned off.
|
|
138
|
-
for checked_filter in filter(lambda f: f.is_selected(), filters):
|
|
139
|
-
checked_filter.click()
|
|
33
|
+
> [!IMPORTANT]
|
|
34
|
+
> Since major version *4.0.0*, this driver is only compatible with Appium 3.
|
|
140
35
|
|
|
141
|
-
# Make sure you can select every filter.
|
|
142
|
-
for filt in filters:
|
|
143
|
-
filt.click()
|
|
144
|
-
assert filt.is_selected()
|
|
145
|
-
filt.click()
|
|
146
|
-
```
|
|
147
36
|
|
|
148
|
-
##
|
|
37
|
+
## Documentation
|
|
149
38
|
|
|
150
|
-
|
|
151
|
-
# clone repo, then in repo dir:
|
|
152
|
-
npm install
|
|
153
|
-
npm run lint
|
|
154
|
-
npm run test
|
|
155
|
-
```
|
|
39
|
+
You can access the documentation here: [**https://appium.github.io/appium-safari-driver**](https://appium.github.io/appium-safari-driver)
|