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
• 16,450 points

3 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

If u want to use TAB key use this:

Actions a= new Actions(driver);
answered Mar 29, 2018 by Johnathon
• 9,050 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,140 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
• 5,900 points
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
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
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
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
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
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
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,050 points
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,050 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.