简体   繁体   English

Appium Python start_activity 与意图

[英]Appium Python start_activity with intents

My question is simple but yet hard to answer.我的问题很简单,但很难回答。 I would like to launch my app with optional_intent_arguments.我想使用 optional_intent_arguments 启动我的应用程序。 But since the python library of appium just supports 2 arguments I am kinda stuck and pissed.但是由于 appium 的 python 库只支持 2 个 arguments 我有点卡住和生气。

I have tried Node js which is working perfectly but I don't want to recode everything I have done so far.我已经尝试过运行良好的 Node js,但我不想重新编码我迄今为止所做的一切。

Error:错误:

TypeError: start_activity() takes exactly 3 arguments (4 given)

Source code:源代码:

desired_caps = desired_caps = {
    'platformName': "Android",
    'platformVersion': "10",
    'deviceName': "my New Phone",
    'automationName': "UiAutomator2",
    'appPackage': mAppPackage,
    'appActivity': ".MainActivity",
    'avd': 'device' + str(mDeviceNr),
    'systemPort': str(mDeviceNr + 4722),
    'dontStopAppOnReset': 'true',
    'noReset': 'true'
}

mDriver = webdriver.Remote('http://127.0.0.1:' + str(mDeviceNr + 4722) + '/wd/hub', desired_caps)

mDriver.start_activity(mAppPackage, ".MainActivity", "<some intent argument in string>")

Without the extra argument, my App is starting perfectly and gets tested but the intent isn't there then.如果没有额外的参数,我的应用程序将完美启动并经过测试,但那时意图不存在。

KazuCocoa on github answered it for me. github 上的 KazuCocoa 为我回答了这个问题。

You can add arguments as keyword-arguments.您可以添加 arguments 作为关键字参数。

eg例如

mDriver.start_activity('xxx.xxx.xxx', '.MainActivity', app_wait_package='your package name')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM