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);
                    }

        }

Answer

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("tu00E9ster")

Leave a Reply

Your email address will not be published. Required fields are marked *