Skip to main content
 首页 » 编程设计

python之在 UIAutomator 中设置文本

2025年05月04日37jpfss

我刚刚探索用于 Android 应用程序测试的 UIAutomator 并遇到了这个问题。

基于 API。

https://github.com/xiaocong/uiautomator#screen-actions-of-the-device

作为探索的一部分,我正在尝试以编程方式添加新联系人。

我已使用此代码到达此页面。

from uiautomator import device as d 
d.click(x,y) #used to click all the way to contacts.  

如何将文本插入名称文本框?由于我不知道类图像并且github上的例子也不多。

请您参考如下方法:

根据文档,应该是

d(text="Settings").set_text("My text...")  # set the text