Appium-Drivers-Safari(Mac/iOS) 朱雀 2023-01-15 10:26 121阅读 0赞 ### The Safari Driver ### * * * * * Requirements and Support * Usage * Capabilities 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. Safari driver从开始添加到Appium1.20版本中 这个驱动是 Apple's safaridriver的二进制文件的包装器 包含在macOS标准发行版中并通过W3C WebDriver协议实现与桌面或移动端浏览器的通信 Development of the Safari driver happens at the appium-safari-driver repo. Safari driver开发在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 `safaridriver` is maintained by Apple, which means it is always in sync with the most recent browser and communication protocol requirements. Appium也支持使用appium-remote-debugger调试 移动端Safari automation和Safari web views automation. 此模式是适用于具有XCUITest automation name的环境切换 它更具普遍性并且比当前Safari driver更灵活. 但它使用未经证明的WebKit秘密通信协议. 这意味着它的开发和维持工作状态所需的努力相对较高. 另外,safaridriver是由苹果公司来维护. 这一位置它始终与最新的浏览器和通信协议同步 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). 简而言之,它更喜欢这个driver假如只需在automate在web application中工作的Safari浏览器(移动或桌面) 万一有必要与本地画家交互或者在不同的应用程序/环境之间切换在实现场景自动化的同时将是XCUITest Driver(对于移动平台)或Mac driver(对于桌面平台)其中一个 ##### Requirements and Support ##### In addition to Appium’s general requirements: * Run the `safaridriver --enable` command from the macOS terminal and provide your administrator password before any automated session will be executed. This only should be done once. 从MacOS终端运行`safaridriver --enable`指令 并在执行任何会话之前提供你的管理员密码, 这只需要做一次 * In order to automate Safari on real devices it is necessary to enable Remote Automation switch in `Settings → Safari → Advanced → Remote Automation` for these particular devices and trust them on the target host. The device’s screen must not be locked while starting tests. 以便automate Safari在真机上实现, 它必须启用远程切换`Settings → Safari → Advanced → Remote Automation` 对于这些特殊设备并在信任到目标主机上. 这个device's屏幕在启动测试时不得被锁定 * Only macOS (High Sierra or newer) is supported as the host platform. 仅MacOS支持主机平台(High Sierra or newer) * 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. 移动端浏览器仅支持iOS13和新版本. 如WebKit博客中所述, Safari不允许为iOS WebDriver-initiated导航在Safari以外的情况处理. 换句话说,点击`tel:// link`'将不会提供呼叫的机会, 并且点击一个app store link,将不会把用户添加到app store. 类似的, non-Safari也会通过系统显示 例如 update dialogs, app notifications, incoming calls, etc.在WebDriver session活动状态时被禁止 ##### Usage ##### The way to start a session using the Safari driver is to include the `automationName` capability in your new session request, with the value `Safari`. Of course, you must also include appropriate `platformName` (`Mac` or `iOS`). Read https://github.com/appium/appium-safari-driver/blob/master/README.md for more details. 开始Safari driver的使用方式包括`automationName`功能在你的新会话请求中 值为'Safari' 当然,你必须包含适配的`platformName` (`Mac` or `iOS`) Read https://github.com/appium/appium-safari-driver/blob/master/README.md for more details. ##### Capabilities ##### The list of available driver capabilities could be found at https://github.com/appium/appium-safari-driver/blob/master/README.md 可用的驱动功能列表可在...查询
还没有评论,来说两句吧...