I’m currently trying to send a string to an android device with appium/java.
When using two different strings like
string1 = “Wow! That is great!” and
string2=“Wow! That is great! !”
with findElement(By.id(editTextID)).sendKeys(stringX).
The first string1 is send without problems. But the second one does not even appear on the screen of the mobile device.
info: --> POST […]/value {“id”:“54”,“value”:[“Wow! That is great! !”]}
info: [debug] Pushing command to appium work queue: [“element:setText”,{“elementId”:“54”,“text”:“Wow! That is great! !”,“replace”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:setText”,“params”:{“elementId”:“54”,“text”:“Wow! That is great! !”,“replace”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: setText
info: [debug] [BOOTSTRAP] [debug] Using element passed in.
info: [debug] [BOOTSTRAP] [debug] Attempting to clear using UiObject.clearText().
info: [debug] [BOOTSTRAP] [debug] Text remains after clearing, but it appears to be hint text.
info: [debug] [BOOTSTRAP] [debug] Text not cleared. Assuming remainder is hint text.
info: [debug] [BOOTSTRAP] [debug] Sending plain text to element: Wow! That is great! !
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:"[…]"}
info: <-- POST […]/54/value 200 5368.662 ms - 76 {“status”:0,“value”:true,“sessionId”:"[…]"}
I tried around with combinations of
caps.setCapability(“unicodeKeyboard”, true);
caps.setCapability(“resetKeyboard”, true);
but that also did not change a think.
Different devices and simulators are also not the reason.
Is there anyone here, who has ever tried this out and made it work? Am I the only person with this problem or am I only the only one who tries to sends emoticons to text fields?
Just idea emotion itself is e.g. “” try so send one by one “that is great! :smi” send another part “le::mon” and so on. Idea is divide smile into several part.
Full disclosure: I don’t need to write emoticons to the screen. However, I do have a joker of a developer who put emoticons in all of our Debug mode screens. So I have to read them from the screen.
We had to monkey patch WebDriver (I’m using Ruby) so that the ‘text’ property would be properly read. Here is the code:
require 'unicode_utils'
module Selenium
module WebDriver
class Element
def text
UnicodeUtils.nfc bridge.getElementText @id
end
end
class Alert
def text
UnicodeUtils.nfc @bridge.getAlertText
end
end
end
end