You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 14:47:26