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

+1 vote
How to get typed text from a textbox by using Selenium Webdriver?
Jun 24, 2019 in Selenium by Ashmita
13,746 views

2 answers to this question.

+1 vote
Best answer

Hey Ashmita, to get the typed text from a textbox, you can use getAttribute(“value”) method by passing arg as value. Value attribute stores the typed text of the textbox element. See the following example to know better: 

String typedText = driver.findElement(By.xpath("xpath_textbox")).getAttribute("value"));
answered Jun 24, 2019 by Abha
• 27,950 points

selected Dec 31, 2019 by Kalgi
thanks for your valueable info and keep on doing like this ..it is really usefull
Hello, can you please upvote the answer if it has helped you?

Thanks :)
+1 vote

var val = driver.findElement(webdriver.By.name("AccToken")).getText();
javascript:
  1. String text = (String) jsExecutor.executeScript("return document.getElementById('txtfirstName').value");  

 

answered Sep 5 by Sri
• 2,970 points

Related Questions In Selenium

0 votes
2 answers

How to get the text from a website using selenium?

driver.findElement(By.cssSelector("p")).getText() or  IWebElement element = Browser.GetElementByCssSelector("div.loginbox p"); string text = ...READ MORE

answered Sep 5 in Selenium by Sri
• 2,970 points
12,010 views
0 votes
2 answers

How to get a page name using Selenium Webdriver (C#)?

String pageTitlte=driver.getTitle(); READ MORE

answered Sep 5 in Selenium by Sri
• 2,970 points
774 views
0 votes
1 answer

How to extract text from a web page using selenium and save it as a text file?

Hello Isha, you can checkout this code ...READ MORE

answered May 7, 2019 in Selenium by Anvi
• 14,110 points
22,144 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,520 points
4,034 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

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

answered Aug 31 in Selenium by Sri
• 2,970 points
4,981 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,890 points
2,921 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 2 in Selenium by Sri
• 2,970 points
3,355 views
0 votes
1 answer
0 votes
1 answer