How to enter text into text field using Selenium WebDriver

0 votes

I want to enter a text into the text field but when I enter the text into the text field it gets removed automatically.

Below is my code:

String barcode="11111000085157";
WebElement element = driver.findElement(By.xpath("//*[@id='div-barcode']"));
element_enter.findElement(By.xpath("//html/body/div[1]/div[3]/div[1]/form/div/div/input")).sendKeys("barcode");
Jul 6, 2018 in Selenium by Johnathon
• 9,080 points
776 views

1 answer to this question.

0 votes

You can use the same code as below:

element_enter.findElement(By.xpath("//html/body/div[1]/div[3]/div[1]/form/div/div/input")).sendKeys(barcode);
answered Jul 6, 2018 by Meci Matt
• 9,420 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to type text in a new line inside a text area using Selenium Webdriver?

Hey Unnati, '\n' is usually used to type text ...READ MORE

answered Jun 25 in Selenium by Abha
• 23,030 points
108 views
0 votes
1 answer
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,090 points
575 views
0 votes
1 answer
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
897 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
565 views
+9 votes
14 answers

How to automate gmail login process using selenium webdriver in java?

Check the below code: Here is the working ...READ MORE

answered Apr 24, 2018 in Selenium by Vardy
• 2,250 points
59,379 views
0 votes
1 answer