python - 在python和appium中,为什么不能使用send_keys()到输入框

标签 python appium sendkeys

描述:当我使用send_keys("xxx")输入框时,有人告诉我

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

这是由什么引起的? 这个插件是太高还是太低了?我的XPath没有错 所以我无法解决它 你愿意帮我解决这个问题吗?谢谢

代码:

                    'newCommandTimeout' :'3000',
                        'unicodeKeyboard': True,
                        'resetKeyboard': True,
                        "automationName": "UiAutomator2"
                        }
        self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)

    def testchangeto_pageone(self):
        time.sleep(3)
        WebDriverWait(self.driver, 10, 0.5).until(
            EC.presence_of_all_elements_located((By.XPATH, "//*[@text='login']")))
        self.driver.find_element_by_xpath("//*[@text='login']").click()
        self.driver.find_element_by_xpath("//android.widget.EditText[@index='0']").click()
        self.driver.find_element_by_xpath("//android.widget.EditText[@index='0']").send_keys("15323423456")

结果:

enter image description here

版本:

  • Selenium :3.1.4.1
  • appium:1.15.1
  • aapium-python-client:0.48

最佳答案

知道是什么原因造成的,因为appium太高了,卸载重装1.8.0

关于python - 在python和appium中,为什么不能使用send_keys()到输入框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59367825/

相关文章:

python - tensorflow 导入导致numpy计算错误

java - 如何在java main方法中添加testng参数?

angularjs - 使用 Protractor + Appium + SauceLabs

remote-desktop - 在远程桌面上运行时替代 SendKeys?

c# - Webdriver "sendkeys"方法没有正确输入密码

python - "TypeError: ' 执行 sess.run() 时键入 ' object is not subscriptable"

python - 直接在 pandas 中打开网站上的 csv 文件,无需下载到文件夹

python - 无法在 Ubuntu 中使用 setup.py 中的 Github Actions 安装 Tensorflow 2.2.0rc0

android - 无法将上下文设置为 WEBVIEW

C# - 如何使用 SendKeys.Send 通过 SHIFT 键发送小写字母?