Unable to enter space in the Textbox using sendkeys() method


#1

Hi all,

I am trying to enter space in the text box using send keys but it is not working instead when command is executed erasing the text

I am using following commands
driver.findElement(By.xpath("//android.widget.EditText[@text=‘Add tag…’]")).sendKeys(“Nails “) . driver.findElement(By.xpath(”//android.widget.EditText[@text=‘Add tag…’]”)).sendKeys(“Nails " +”\n") driver.findElement(By.xpath("//android.widget.EditText[@text=‘Add tag…’]")).sendKeys(“Nails " +” ")

and tried with adb commands as well

I am working on react native app.
and using appium latest version 1.9.1

java client jar 1.6


#2

Have you treid using Keys.SPACE or just sending your string with etxra space.
driver.findElement(By.xpath("//android.widget.EditText[@text=‘Add tag…’]")).sendKeys(“Nails“+Keys.SPACE);
Please try this and share if any exception is coming. .


#3

Thank you @auto_mate for the reply.
Yes, its taking space while entering the text in the text box.

But my issue is by giving space after the text. The given text automatically turn into Tag as shown in the below Picture.

But When I try with the Appium its just taking the space after entering the Text not turning as Tag

I am working on the react native app


#4

When you manually enter it , is it accepting space or considering it as tag ?Also Can you please explain functionality of that textbox


#5

yes, When I manually enter text in the textbox and click on the space it automatically turn to tag. This is the manual behaviour of the text box.

But when I am doing from appium it is taking the space and not changing to tag.


#6

ok, so after entering our text simply click outside somewhere or use extra sendKeys like this
driver.findElement(By.id(“yourID or whatever”)).sendKeys(Keys.ENTER); or Keys.RETURN and this should do what you expecting.


#7

Hey @Srinija is your issue resolved ?


#8

No, it didn’t worked for me. Its doing the same thing just erasing everything instead of giving the space


#9

Well that is something unexpected because i have tested some of these kinds of textbox and that worked fine for me if i used driver.sendKeys(Keys.RETURN) after entering text.
Is that app available somewhere so that i can confirm that ? What is your platform IOS or android @Srinija


#10

Thank you for your reply,