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,090 points
16,459 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,460 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, 2019 in Selenium by Abha
• 28,140 points
13,945 views
+1 vote
4 answers

How to get typed text from a textbox by using Selenium Webdriver?

Hey Ashmita, to get the typed text ...READ MORE

answered Jun 25, 2019 in Selenium by Abha
• 28,140 points
39,885 views
0 votes
2 answers

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,500 points
13,676 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,144 views
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,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
+10 votes
17 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,360 points
197,977 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP