Android 自动化测试:无法在文本字段中输入文本

问题描述

尝试使用 appium 和 python 为 android 应用编写测试。

在 uiautomatorviewer 的帮助下,我得到了元素:

uiautomatorviewer screen structure

我能够找到这个元素,甚至点击它:

    def testFirstAutomation(self):
    self.driver.find_element_by_xpath("//android.widget.Button[@index='4']").click()
    self.driver.find_element_by_xpath("//android.widget.EditText[@index='1']").click()

我得到的对象是一个类:

<class 'appium.webdriver.webelement.WebElement'>
    

但是如果我尝试将 send_keys('x') 发送到元素,我会得到:

selenium.common.exceptions.InvalidElementStateException: Message: Cannot set the element to '1'. Did you interact with the correct element?

怎么了?将登录名和密码输入|粘贴到文本字段中的正确方法是什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)