python+appium,sendkeys输入不了内容,无论中文还是数字怎么办?

sendkeys其他输入框都能输入,只有这个不能输入,能够定位到输入框,能看得见光标显示了,无论是ID定位还是xpath定位最多也只是显示光标,有过一次手动输入几个字符后成功的输入进去了。贴代码

#输入手机号
account_name = driver.find_element_by_id('com.eestar:id/edtPhone').send_keys("15512341234")
#输入验证码
password = driver.find_element_by_id('com.eestar:id/edtCode').send_keys("1111")
#点击登录
driver.find_element_by_id("com.eestar:id/txtLogin").click()

#点击首页唯一直播
driver.find_element_by_id("com.eestar:id/txtTitle").click()
#输入聊天内容
time.sleep(5)
#a = 123
driver.find_element_by_id("com.eestar:id/txtChat").send_keys("3369")

图片说明

光标能显示到输入框中,当时最终还是报错,只有这个一个输入框这样,是什么情况呢?

python报错信息:

    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: UiSelector[INSTANCE=0, RESOURCE_ID=com.eestar:id/txtChat]

appium提示信息:

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Attempting to clear using UiObject.clearText().
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":7,"value":"UiSelector[INSTANCE=0, RESOURCE_ID=com.eestar:id\/txtChat]"}
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
[W3C] Encountered internal error running command: NoSuchElementError: UiSelector[INSTANCE=0, RESOURCE_ID=com.eestar:id/txtChat]
[W3C]     at errorFromMJSONWPStatusCode (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:786:12)
[W3C]     at Socket. (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-android-driver\lib\bootstrap.js:139:18)
[W3C]     at Socket.emit (events.js:182:13)
[W3C]     at addChunk (_stream_readable.js:279:12)
[W3C]     at readableAddChunk (_stream_readable.js:260:13)
[W3C]     at Socket.Readable.push (_stream_readable.js:219:10)
[W3C]     at TCP.onread (net.js:636:20)
[HTTP] <-- POST /wd/hub/session/c4687604-09d8-4943-9e04-29703be054ca/element/8/value 404 24825 ms - 768
[HTTP] 

2个回答

a = driver.find_element_by_id("com.eestar:id/txtChat").click()
time.sleep(1)
a.send_keys("3369")

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问