appium-uiautomator2-server
appium-uiautomator2-server copied to clipboard
"Cannot set the element to...Did you interact with the correct element?" error
https://github.com/appium/appium-uiautomator2-server/blob/1786d0c84d75fff79fde5255be0a9ec6ea222e42/app/src/main/java/io/appium/uiautomator2/handler/SendKeysToElement.java#L67
Multiple focused elements exist on the same page,findElement(focused(true))
can't find the right element. I got "Cannot set the element to...Did you interact with the correct element?" error.
Whether the findElement
here should be called in combination with clazz("EditText")
and focused(true)
?
My solution is that:
- Install Yosemite on test phone. https://github.com/AirtestProject/Airtest/blob/master/airtest/core/android/static/apks/Yosemite.apk
- adb shell ime set com.netease.nie.yosemite/.ime.ImeService
- adb shell settings get secure default_input_method # save the default input method to a variable
- adb shell am broadcast -a ADB_INPUT_TEXT --es msg '你好' # set text to your input after it is clicked
- adb shell ime set <defaultIme> # restore the default input method
just use shelljs to execute the commands in code to walk around the cannot use setValue issue.