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.
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
2- Click on Java Compiler to 1.5 or later
3- Check the latest version or select from dropdown
4- Now you are done. Go back to the program and you will notice no error will be present.
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
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
Mukesh Otwani says
Hi Nancy, can u share the code snippet?
sathish says
sir i am still not able to solve the issue, the section in java compiler >>> jdk compliance not selecting in my eclipse
Mukesh Otwani says
Please use Java 11
saikumar says
hi
after updating 1.6 stil its geetinf error
Mukesh Otwani says
Try with 11
Sourabh says
Thanks the solution given here fixed the issue
Mukesh Otwani says
That’s great…:)
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.
Mukesh Otwani says
Thanks for providing your feedback, Varsha…:)
Prabhakaran says
Thanks !! It fixed the issue
Mukesh Otwani says
Great…:)
Ritika says
Thanks It helped a lot.
Mukesh Otwani says
Ritika, you’re always welcome…:)
Debanjan Bhattacharjee says
This article is super awesome. No other blog or tutorials explain this.
Mukesh Otwani says
Hi Debanjan,
Thanks for appreciation…:)
Please feel free to ask your doubts…
vijay shetty says
automating google home page
normal sendkeys alphabet working but fucntion key not working,can u confirm?
Mukesh Otwani says
Hi Vijay,
You can use robot class for function keys. For details, please refer this link http://learn-automation.com/robot-class-in-selenium-webdriver/
Function keys are not supported by Selenium as OS doesn’t know about Fn keys
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();
Mukesh Otwani says
Hi Sam,
Use driver.findElement(By.id(“identifierId”)).sendKeys(“abc“);
Riya says
still stuck with same problem, i am not able to check- checkbox after changing compiler version from 1.4 to 1.6
Mukesh Otwani says
Hi Riya,
Also go to Java Build Path -> Libraries -> Select Java SE 1.8(if Java 8 is installed)
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.
Jagadeesh says
Sry it’s data(Text) not date
Mukesh Otwani says
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.
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 .
Mukesh Otwani says
Hi Tarun,
Have you changed your compiler level? Moreover I recommend you to use Java 8.
Angel says
working !! thanks for the solution
Mukesh Otwani says
Great…:)
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…
Mukesh Otwani says
Hi Mahadev what issue you are getting with Chrome?
Samreen Siddiqui says
Still the issue is coming
Mukesh Otwani says
Hi Samreen,
Which version of JDK have you installed?
Prasanna says
Thanks for the Solution
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.
Mukesh Otwani says
Hi Balaji.
Kindly explain your exact requirement.
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
Mukesh Otwani says
Hi Prashant,
Which architecture version of IEDriver are you using, 32 Bit or 64 Bit?
Prashant says
64 bit version of IE i am using
Mukesh Otwani says
Hi Prashant,
I would recommend you to use 32 bit IEDriver version and let me know how it is behaving…
Prashant says
It behaves same as for 64bit version and even more issues 🙂
Mukesh Otwani says
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.
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?
Mukesh Otwani says
Hi Sandeep,
Kindly change Compiler Compliance level to 1.8 and let me know.
siva says
Hi
I am also facing similar kind of issue during send keys using time.Kindly help me to resolve ..
Mukesh Otwani says
Hi Siva,
Have you followed all steps mentioned blog post content?
Anil says
How to use type() and typeKeys() in WebDriver can u provide some example? because sendkeys is not working
Mukesh Otwani says
Hi Anil,
These two commands are specific to Selenium IDE not for Webdriver. In your case, you can give try to robot class.
saket kumar says
in my system showing 1.6 latest. code is still showing same error. And check box is not markable
Mukesh Otwani says
Hi Saket,
Upgrade java to version 8
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
Mukesh Otwani says
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.
Tarun Tyagi says
in my system showing 1.6 latest. code is still showing same error. And check box is not markeble
Mukesh Otwani says
Hi Tarun,
Check whether you have other java installation on machine.
Gaurav Khurana says
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
Mukesh Otwani says
Great 🙂
Naina says
Compiler veraion I am using is 1.8 and jre version 1.7
Bidhulata Sahu says
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.
Mukesh Otwani says
Try with new version of Eclipse and create fresh project.
PThanh says
It’s useful.
I can solve the issue by your artical.
Thanks
Mukesh Otwani says
Cheers Mate
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”
Mukesh Otwani says
Hi Vandana,
Can you please try with fresh project and make sure while creating new project select JRE 1.8 only.
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
Mukesh Otwani says
Hi Shipra,
Can you create fresh project and try again.
Note- While creating project select latest JRE option. It will work
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
Mukesh Otwani says
is it fixed?
Sivani says
Thanks for the info..really helped
Mukesh Otwani says
Thanks and I am glad to know that you find it usefull. Keep learning.
Sathya says
Thanks for information.
Mukesh Otwani says
Thanks Sathya
Sajith Kumar says
Hi,
Done the same. But still error exists.
Help needed desperately.
Mukesh Otwani says
Hi Sajith,
Above solution worked for me always.
sridhar says
Im new to selenium and got this issue. Thanks lot for the solution and root cause which was so helpful.
Mukesh Otwani says
Thanks Sridhar
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
Mukesh Otwani says
Hi Ishan,
is this fixed?
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
Mukesh Otwani says
Thanks Malikarjun Glad to know that you are able to relate it.
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
Mukesh Otwani says
Hi Linh,
Can you try creating new project and while creating select JRE 1.8