0

Need to get text from entered input field from client side before saving the record?

1
  • 2
    Did you considered reading the WedDriver docs? Just read it once through, to get idea what methods are available. Especially if you want to have "Guru" in your name :-) – Peter M. - stands for Monica Apr 26 '18 at 14:12
0

Use getAttribute() method of WebElement. You need value attribute. Like it is shown in my example:

driver.get("https://www.wikipedia.org/");
WebElement input = driver.findElement(By.xpath("//input[@id='searchInput']"));
input.sendKeys("My Test");
System.out.println(input.getAttribute("value"));
0

Cant you do somthing like this. Rather than getting a entered text why cant you enter a text that you already defined in your text.

 string EnteredTxt = "what ever the text";
 Driver.FindElement(By.XPath("//input[@id='searchInput']")).SendKeys(EnteredTxt);

Not the answer you're looking for? Browse other questions tagged or ask your own question.