gpt4 book ai didi

python - 使用 pythonista 通过手机使用 appium 打开应用程序

转载 作者:太空宇宙 更新时间:2023-11-03 20:21:55 26 4
gpt4 key购买 nike

我想使用 python 在手机上自动执行任务。我一直在寻找与 IOS 兼容的模块,但没有成功。我不确定 appium 因此为什么我问这个问题。是否可以运行 appium ,在手机上打开应用程序,然后单击应用程序中的按钮?我尝试使用 pyautogui 单击按钮,并使用网络浏览器通过 url 方案打开应用程序(有效),但 pyautogui 无法在 IOS 上运行。我还没有开始编写代码,因为我仍在寻找开始的地方。

最佳答案

是的,这是可能的,这就是 Appium 本质上的用途。

网上有很多关于如何启动和运行 Appium 的教程: https://medium.com/@ilovemark/appium-installation-and-configuration-under-macos-edd2375dcce

所需功能告诉 Appium 要运行哪个操作系统、应用程序版本等: http://appium.io/docs/en/writing-running-appium/caps/

您还需要 Appium Python 客户端:pip install Appium-Python-Client

现在您可以在 Simulator 中运行测试,在本地真实设备上运行应用程序并不简单,因此我建议从 Xcode Simulator 开始。

from appium import webdriver

URL = 'http://localhost:4723/wd/hub'

DESIRED_CAPABILITY = {
'app': 'full/path/to/app/location.app'
'platformName': 'iOS',
'platformVersion': '12.1',
'automationName': 'XCUITest',
'browserName': '',
'deviceName': 'iPhone X',
}


def test_open_app():
driver = webdriver.Remote(URL, DESIRED_CAPABILITY)

关于python - 使用 pythonista 通过手机使用 appium 打开应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58108872/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com