Unable to send password using sendKeys() function.

Hi All,

I’m new to selenium.

Unable to send password using sendKeys() function.

I tried finding the element using xpath, css as well as id, but it didn’t work out.

Kindly help me with this.

Thank you

sowmya Default Asked on September 4, 2015 in Selenium WebDriver.
Add Comment
2 Answer(s)

package package_name;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class Password {

public static void main(String[] args)
System.setProperty(“webdriver.chrome.driver”, “Path of chromedriver.exe”);
WebDriver driver = new ChromeDriver();
WebElement email = driver.findElement(By.id(“login-username”));
email.sendKeys(“Enter your email”);

WebElement password = driver.findElement(By.id(“login-passwd”));



BhavinR Train Answered on September 5, 2015.
Add Comment

What error do you get when trying to interact with the password text field?

Try locating the password element by CSS locator:

c4ncri Train Answered on November 20, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.