gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 19:59:02 25 4
gpt4 key购买 nike

描述:当我使用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/

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