Search code examples
javaandroidappium

Unable to send keys string containing acute character


I'm trying to enter in a string that contains an acute in a character but it doesn't seem to enter in the character. I don't think the unicode keyboard is enabling and not sure why:

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();

         public void enterYourDetailsCredentials(String firstName) {

        if (firstNameEntry.contains("téster)){
                    desiredCapabilities.setCapability("unicodeKeyboard", true);
                    signUpPage.firstNameTextField.sendKeys("téster");
                    desiredCapabilities.setCapability("resetKeyboard", true);
                }else
                    {
                    signUpPage.firstNameTextField.sendKeys(firstName);
                    }

        }

Solution

  • If you want to print a specific character in a string, you can just use Unicode escape sequence \u followed by the character code you wish. You can access a list of those codes here: http://www.unicode.org/charts/

    So, in your particular case, you can do it as follow on the lines that you wish to implement the acute:

    signUpPage.firstNameTextField.sendKeys("t\u00E9ster")