sendKeys() not working in Selenium Webdriver

+1 vote

I was trying to send keys to a text box and send a tab key both at the same time to check for the availabilty of the username

Below you can find the code:

 driver.findElement(By.xpath("//label[text()='User Name:']/following::div/input")).sendKeys("UserName");
 driver.findElement(By.xpath("//label[text()='User Name:']/following::div/input")).sendKeys(Keys.TAB);

Its not working.

Mar 29, 2018 in Selenium by Perry
• 17,010 points
10,617 views

3 answers to this question.

0 votes

If u want to use TAB key use this:

Actions a= new Actions(driver);
a.keyDown(Keys.TAB).perform()
answered Mar 29, 2018 by Johnathon
• 9,070 points
0 votes
driver.findElement(By.xpath("//label[text()='User Name:']/following::div/input")).sendKeys("Keys.RETURN");
answered Feb 7 by anonymous
Can you please explain the difference?
0 votes
driver.findElement(By.xpath("//label[text()='User Name:']/following::div/input")).sendKeys("UserName",Keys.TAB);

By using a comma you can send both username and key-stroke at the same time.

answered Feb 7 by Priyaj
• 56,160 points

Related Questions In Selenium

0 votes
1 answer

findElement(By.xpath()) not working using Selenium WebDriver

element = findElement(By.xpath("//*[@test-id='test-username']"); element = findElement(By.xpath("//input[@test-id='test-username']"); (*) - any ...READ MORE

answered Apr 18, 2018 in Selenium by code_ninja
• 6,160 points
1,374 views
0 votes
1 answer

Selenium WebDriver.get(url) not working

It is a Selenium defect. Problem is ...READ MORE

answered Jun 7, 2018 in Selenium by Meci Matt
• 9,400 points
1,632 views
0 votes
1 answer

Check that the element is clickable or not in Selenium WebDriver

Use Selenium Waits: WebDriverWait ...READ MORE

answered Jun 12, 2018 in Selenium by Meci Matt
• 9,400 points
6,655 views
0 votes
1 answer

Send keys not working selenium webdriver python

As you mentioned send_keys("TEST") are not working, there are ...READ MORE

answered Sep 28, 2018 in Selenium by Meci Matt
• 9,400 points
1,734 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
274 views
0 votes
1 answer
0 votes
1 answer

What is the role of TestNG & JUnit frameworks in Selenium?

Well TestNG and JUnit are test frameworks ...READ MORE

answered Apr 18, 2018 in Selenium by king_kenny
• 3,590 points
193 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
639 views
0 votes
1 answer

Java.lang.CharSequence cannot be resolved error while using sendKeys() using Selenium Webdriver

You could try this, myElement .sendKeys(new String[] { ...READ MORE

answered Apr 4, 2018 in Selenium by Johnathon
• 9,070 points
552 views
0 votes
1 answer

Radio button using Selenium WebDriver

This code will help you out: import java.util.List; ...READ MORE

answered Apr 11, 2018 in Selenium by Johnathon
• 9,070 points
936 views