Automatically fill the textbox with a value

You have created a web form which has a textbox to input some value. While testing this form in Selenium, you want to automatically fill the textbox with a value XBOX.

Which of the following lines of code will you use if the name of textbox is first and the id is one?

Options
1.WebElement input1 = driver.findElement(By.name("first"));
input1.sendKeys("XBOX");
2.WebElement input1 = driver.findElement(name == "first"));
input1.value("XBOX");

3.WebElement input1 = driver.findElement(UsingId("one"));
input1.value("XBOX");

4.WebElement input1 = driver.findElement(Id=="one"));
input1.sendValue("XBOX");

Related Posts

Close Bitnami banner
Bitnami