描述:当我使用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")
结果:
版本:
- 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/