android remote shell,关于 Appium V1.7.2 新增的唯一安卓可执行 mobile 命令 shell 的疑问...

关于 mobile: shell 在更新日志中说明,是从 1.7.1 升级到 1.7.2 中 “Add --relaxed-security, and mobile: shell access to adb”,并搜索 github 中 appium 库,找到需要配置 desiredcapabilities 中 relaxedSecurityEnabled 为 true,但实际执行无效。

TesterHome 社区有没有 Appium 项目组的大牛,能否跟进了解一下这个 mobile: shell 到底如何使用

我的 python 代码:

###

···python

def AndroidAppEmulator(platformVersion, appActivity, appPackage):

caps = {}

caps['relaxedSecurityEnabled'] = True

caps['automationName'] = 'UiAutomator2'

caps['platformName'] = 'Android'

caps['platformVersion'] = platformVersion

caps['deviceName'] = 'Android Emulator'

caps['appPackage'] = appPackage

caps['appActivity'] = appActivity

caps['unicodeKeyboard'] = True

caps['resetKeyboard'] = True

return WebDriver('http://127.0.0.1:4723/wd/hub', caps)

driver = learnappium.AndroidAppEmulator('7.1.1','.DialtactsActivity','com.android.dialer')

opts={'command':'am',

'args':['start','-N','com.android.calculator2/.Calculator']}

driver.execute_script('mobile: shell', opts)

报错信息如下:

###

···

File "C:/Users/jack/PycharmProjects/AppiumTest/learnappium/Test06.py", line 9, in

print(driver.execute_script('mobile: shell', opts))

File "C:\Users\jack\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium-3.8.0-py3.6.egg\selenium\webdriver\remote\webdriver.py", line 546, in execute_script

'args': converted_args})['value']

File "C:\Users\jack\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium-3.8.0-py3.6.egg\selenium\webdriver\remote\webdriver.py", line 311, in execute

self.error_handler.check_response(response)

File "C:\Users\jack\AppData\Local\Programs\Python\Python36\lib\site-packages\appium_python_client-0.26-py3.6.egg\appium\webdriver\errorhandler.py", line 29, in check_response

File "C:\Users\jack\AppData\Local\Programs\Python\Python36\lib\site-packages\appium_python_client-0.26-py3.6.egg\appium\webdriver\errorhandler.py", line 24, in check_response

File "C:\Users\jack\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium-3.8.0-py3.6.egg\selenium\webdriver\remote\errorhandler.py", line 237, in check_response

raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Appium server must have relaxed security flag set in order to run any shell commands

···

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值