如何在Sauce Labs启动Appium会话时传入--relaxed-security参数
在Sauce Labs真实设备上启用Appium宽松安全模式以执行adb命令
嘿,我来帮你搞定这个问题!要在Sauce Labs的真实设备会话里使用--relaxed-security参数执行adb shell命令,不用纠结本地启动Appium的方式——因为Sauce Labs是托管的Appium服务,你只需要在desired capabilities里添加对应的配置项就行。
具体做法是在你的capabilities字典里新增一个sauce:options嵌套字段,然后把appium:relaxedSecurityEnabled设为True,这样Sauce Labs的Appium服务器就会启用宽松安全模式,允许你执行需要权限的adb操作。
修改后的代码示例如下:
desired_capabilities = { "deviceName": "xxx", "platformName": "xx", "platformVersion": "xx", "bundleId": "xxx", "automationName": "uiautomator2", "testobject_api_key" : "xxx", "sauce:options": { "appium:relaxedSecurityEnabled": True } } driver = webdriver.Remote("https://us1-manual.app.testobject.com/wd/hub", desired_capabilities)
需要提醒的是:宽松安全模式会绕过Appium的部分安全限制,只在你确实需要执行特定adb命令时启用,平时尽量保持默认设置,避免不必要的安全风险。
内容的提问来源于stack exchange,提问作者Mahesh S
相关产品推荐
相关产品推荐

