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

问题描述 投票:1回答:1

描述:当我使用send_keys(“ xxx”)到输入框时,被告知

selenium.common.exceptions.InvalidElementStateException:消息:无法将元素设置为'15323423456'。您是否与正确的元素进行了交互?

这是由什么引起的?这个插件太高还是太低?我的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

版本:

  • 硒:3.1.4.1
  • appium:1.15.1
  • aapium-python-client:0.48
python appium sendkeys
1个回答
0
投票

我知道是由于appium太高造成的。未安装并重新安装1.8.0

© www.soinside.com 2019 - 2024. All rights reserved.