RE: 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

sowmya Default Asked on September 4, 2015 in Selenium WebDriver.
Add Comment
2 Answers

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();
driver.get(“https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com”);
driver.manage().deleteAllCookies();
WebElement email = driver.findElement(By.id(“login-username”));
email.sendKeys(“Enter your email”);

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

}

}

Train Answered on September 5, 2015.
Add Comment

Your Answer

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