Earn Money in 10 days

Selenium Videos

Protractor In Selenium

Livechat

Monday, 1 December 2014

How to enter text into Textbox in Selenium Webdriver

Enter text intoTextbox in WebDriver

In Selenium we have sendkeys() method of Webdriver Interface for Typing in textbox of username and password.


sendKeys()- This method will accept string as an argument whatever text you will specify it will type into that textbox.
//Here is the code for textbox
package test;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Facebook {

public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get("http://facebook.com");
//Enter the text into emailaddress
driver.findElement(By.xpath("//*[@id='Email']")).sendKeys("ritu7180@gmail.com");
//Enter the text into password Filled
driver.findElement(By.xpath("//*[@id='Passwd']")).sendKeys("password");
        
}

}

0 comments:

Post a Comment

Popular Posts

 
subscribe
Subscribe Us
emailSubscribe to our mailing list to get the updates to your email inbox... We can't wait more to have your email in our subscribers email list. Just put your nice email in below box: