Basic Selenium

Solution for sendkeys(CharSequence) in Selenium

If you are working with Selenium and if SendKeys is not working in Selenium then you have to do small settings which will fix your issue.

Please refer below screenshot for the exact problem statement.

 

SendKeys is not working in Selenium

 

Solution if SendKeys is not working in Selenium

Problem Statement for sendkeys(CharSequence) in Selenium

This is one of the most common problems for guys who are new in Selenium Webdriver. If you are on this issue then do not worry there are some configuration changes only that I will show you in next few minutes.

 

Sometimes while creating project compiler version will be below 1.5 version so Selenium method that is sendKeys will not able to read by the compiler so we need to upgrade the compiler version to 1.5 and above.

 

The error which will come is

” sendKeys (CharSequence) from the type Webelement refers to the missing type charSequence

 

 

Solution for sendkeys(CharSequence) in Selenium

you will be happy to know that we have two solutions for this I will tell you the first one in detail and the second one is quite easy that you can try from the end as well.

1- Change the compiler version from old version to 1.5 or greater.

2- Change the JRE version from JRE8 to JRE7.

 

 

How to change the compiler version

1- Right click on project 

 

SendKeys is not working in Selenium

 

2- Click on Java Compiler to 1.5 or later

 

sendkey issue detected

 

3- Check the latest version or select from dropdown

 

Save changes

 

4- Now you are done. Go back to the program and you will notice no error will be present.

 

Selenium issue fixed

If you are still finding any issue while creating scripts in Selenium webdriver just comment below. We all are here to help each other.

 

 

For More updates Learn Automation page

For any query join Selenium group- Selenium Group

 

 

author-avatar

About Mukesh Otwani

I am Mukesh Otwani working professional in a beautiful city Bangalore India. I completed by BE from RGPV university Bhopal. I have passion towards automation testing since couple of years I started with Selenium then I got chance to work with other tools like Maven, Ant, Git, GitHub, Jenkins, Sikuli, Selenium Builder etc.

81 thoughts on “Solution for sendkeys(CharSequence) in Selenium

  1. Nancy says:

    Hi,

    I am facing the issue “The method sendKeys(WebDriver, WebElement, Duration, String) in the type SynchronizationInSelenium(class name) is not applicable for the arguments (ChromeDriver, WebElement, int, String) while trying to use generic function using “WebDriverWait” (basically the explicit wait).

    Tried to make changes in Java compiler but still seeing this issue.

    JRE: 18.9

    Could you please help me in resolving this issue.

    Thanks
    Nancy

    1. Hi Nancy, can u share the code snippet?

  2. sathish says:

    sir i am still not able to solve the issue, the section in java compiler >>> jdk compliance not selecting in my eclipse

    1. Please use Java 11

  3. saikumar says:

    hi
    after updating 1.6 stil its geetinf error

  4. Sourabh says:

    Thanks the solution given here fixed the issue

  5. Varsha says:

    Thanks a lott Mukesh!! I almost spent 1 hr time inorder to send the text in to the text field of email address in Flipkart application. I have tried javascript executor, actions class etc; none of them threw the error but text is not entering in to the text filed. I have followed the steps mentioned by you and it worked finally!!! You are savior of people who want to learn selenium.

    1. Thanks for providing your feedback, Varsha…:)

  6. Prabhakaran says:

    Thanks !! It fixed the issue

  7. Ritika says:

    Thanks It helped a lot.

    1. Ritika, you’re always welcome…:)

  8. Debanjan Bhattacharjee says:

    This article is super awesome. No other blog or tutorials explain this.

    1. Hi Debanjan,

      Thanks for appreciation…:)
      Please feel free to ask your doubts…

  9. vijay shetty says:

    automating google home page
    normal sendkeys alphabet working but fucntion key not working,can u confirm?

    1. Hi Vijay,

      You can use robot class for function keys. For details, please refer this link https://vistasadprojects.com/mukeshotwani-blogs-v2/robot-class-in-selenium-webdriver/
      Function keys are not supported by Selenium as OS doesn’t know about Fn keys

  10. sam says:

    hello I am new to selenium sendkey compiler thing worked for me thanks alot . I am trying to enter email or phone gor gmail login and click next button but its not working

    i used driver.findElement(By.id(“identifierId”)).sendKeys(“abc “+Keys.TAB);

    driver.findElement(By.id(“identifierNext”)).click();

    1. Hi Sam,

      Use driver.findElement(By.id(“identifierId”)).sendKeys(“abc“);

  11. Riya says:

    still stuck with same problem, i am not able to check- checkbox after changing compiler version from 1.4 to 1.6

    1. Hi Riya,

      Also go to Java Build Path -> Libraries -> Select Java SE 1.8(if Java 8 is installed)

  12. Jagadeesh says:

    Hi this is jagadeesh. I am facing issue in iOS appium web. after entering date in text box it’s clearing in 2seconds . Please let me know if you have any solution.

    1. Jagadeesh says:

      Sry it’s data(Text) not date

      1. Hi Jagadeesh,

        Can you try something like, after entering data, press tab key/ click somewhere to remove focus from input box and let me know with observation.

  13. Tarun Mukherjee says:

    I am getting the error while reading data from property file .
    ERROR:
    java.lang.IllegalArgumentException: Keys to send should be a not null CharSequence

    There’s no compiling errors. But this exception is thrown while the test is run .

    1. Hi Tarun,

      Have you changed your compiler level? Moreover I recommend you to use Java 8.

  14. Angel says:

    working !! thanks for the solution

  15. Mahadev says:

    Hi Mukesh,

    I have Jdk 1.8 and JRE 1.8 latest version. Its working fine for Firefox browser(64-bit) but not for chrome(64-bit). Please let me know how to resolve this issue.

    Thanks a lot…

    1. Hi Mahadev what issue you are getting with Chrome?

  16. Samreen Siddiqui says:

    Still the issue is coming

    1. Hi Samreen,

      Which version of JDK have you installed?

  17. Prasanna says:

    Thanks for the Solution

  18. Balaji Mahendran says:

    Hi Guys, Upon defining the sendkeys in POM class
    public void Mail_enter(String Admmailaddress) {

    Admmail.sendKeys(Admmailaddress);

    }
    This will be called in testng class using Pagefactory. I am using data driven framework.So that data is stored in excel sheet and called using dataprovider annotations.

    1. Hi Balaji.

      Kindly explain your exact requirement.

  19. Prashant says:

    Hi Mukesh, I am working on 1.8 version.still i am facing similar issue that sometimes it is not typing complete value to the text box on IE. and sometime click event is also not working. i have already put code for waiting element to be visible and clickable.. can you please help what else i should do to work consistently? Thanks

    1. Hi Prashant,

      Which architecture version of IEDriver are you using, 32 Bit or 64 Bit?

      1. Prashant says:

        64 bit version of IE i am using

        1. Hi Prashant,

          I would recommend you to use 32 bit IEDriver version and let me know how it is behaving…

          1. Prashant says:

            It behaves same as for 64bit version and even more issues 🙂

          2. Hi Prashant,

            Are you getting error message which I’ve posted in concerned topic(i mean sendkeys(charsequence) error) or is it simply not doing sendkeys action on UI?
            I would also recommend you to use latest version of Selenium and corresponding IEDriverServer.exe. if you’re not.

  20. Sandeep says:

    Hi Mukesh, I changed to version 1.6 but unable to select JDK Compliance check box. I am using Eclipse Helios, is this the problem?

    1. Hi Sandeep,

      Kindly change Compiler Compliance level to 1.8 and let me know.

  21. siva says:

    Hi

    I am also facing similar kind of issue during send keys using time.Kindly help me to resolve ..

    1. Hi Siva,

      Have you followed all steps mentioned blog post content?

  22. Anil says:

    How to use type() and typeKeys() in WebDriver can u provide some example? because sendkeys is not working

    1. Hi Anil,

      These two commands are specific to Selenium IDE not for Webdriver. In your case, you can give try to robot class.

  23. saket kumar says:

    in my system showing 1.6 latest. code is still showing same error. And check box is not markable

    1. Hi Saket,

      Upgrade java to version 8

  24. ZORO says:

    Hi Mukesh,
    I am trying to write one program in Selenium, in which i am trying to log-in through the username and password like as in gmail.
    But when i run the program it gives error sendkeys(CharSequence), I have tried all the configurations and tricks mentioned by you in the blog, but it is not working.
    Any other suggestions/help you can provide will be indebted.
    Regards
    ZORO

    1. Hi Zoro,

      Please check whether the locators are correct. Moreover in some applications, sendKeys for input box doesn’t work in one shot, so first do click inside input box and then try with sendKeys action.

  25. Tarun Tyagi says:

    in my system showing 1.6 latest. code is still showing same error. And check box is not markeble

    1. Hi Tarun,

      Check whether you have other java installation on machine.

  26. Though i have never faced this problem. But intentionally change the settings to see this problem from 1.8 to 1.4 and i was able to reproduce the problem.

    Very well reported Mukesh. Thanks

  27. Naina says:

    Compiler veraion I am using is 1.8 and jre version 1.7

  28. if i will use 1.7 jdk then it is not showing error BUT while i tried to run the programme it is showing “java exception error occured ” with a new pop up box named java virtual machine launcher.

    1. Try with new version of Eclipse and create fresh project.

  29. PThanh says:

    It’s useful.
    I can solve the issue by your artical.
    Thanks

  30. vandana says:

    Hi ,

    Iam using Selenium 3.0 .0 beta 3 version with JRE 1.8.0.101.
    Compiler Compliance level 1.7

    Iam getting following error
    “The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
    The method sendKeys(CharSequence…) from the type WebElement refers to the missing type CharSequence”

    1. Hi Vandana,

      Can you please try with fresh project and make sure while creating new project select JRE 1.8 only.

  31. shipra garg says:

    Hi
    I have updated the compiler compliance from 1.4 to 1.76 but still the error is there.

    I am using JRE 1.8.0_91

    Please help me out.

    Thanks ,
    Shipra Garg

    1. Hi Shipra,

      Can you create fresh project and try again.

      Note- While creating project select latest JRE option. It will work

  32. Himani says:

    Hi,
    I am using selenium 3 beta 2 with Firefox. And Java 1.8.0_65 version. Done above steps but sendkeys error is still appearing in console. Could you help in this regard.

    Thanks in advance

  33. Sivani says:

    Thanks for the info..really helped

    1. Thanks and I am glad to know that you find it usefull. Keep learning.

  34. Sathya says:

    Thanks for information.

  35. Sajith Kumar says:

    Hi,

    Done the same. But still error exists.

    Help needed desperately.

    1. Hi Sajith,

      Above solution worked for me always.

  36. sridhar says:

    Im new to selenium and got this issue. Thanks lot for the solution and root cause which was so helpful.

  37. Ishan Agarwal says:

    Hi,

    I have updated the compiler compliance from 1.4 to 1.7 but still the error is there.

    I am using JRE 1.8.0_66

    Please help me out.

    Thanks,
    Ishan

    1. Hi Ishan,

      is this fixed?

  38. Mallikarjun says:

    Thanks for info

    I too faced this problem when I was new to selenium but i didn’t know d reason for it and i forgot abt dis

    By reading this blog only I came 2 know d exact reason 4 it

    1. Thanks Malikarjun Glad to know that you are able to relate it.

      1. linh says:

        Hello Mukesh Otwani,

        Compliance level: 1.8
        JRE 1.8.0_45
        but it does not work in my side.

        could you please give some help?

        Thanks,
        Linh

        1. Hi Linh,

          Can you try creating new project and while creating select JRE 1.8

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.