How to get the text value which is not present in HTML dom, but present in UI.
Asked
Active
Viewed 1,288 times
-2

mahan
- 12,366
- 5
- 48
- 83

bhargav porapu
- 29
- 8
-
The value will be on the dom, check out the other html elements around the input control, you'll find it in there somewhere. – bower Jun 08 '18 at 10:27
-
checked everywhere ,not present in DOM – bhargav porapu Jun 08 '18 at 10:33
-
The accepted answer is not good but check prestomanifesto's answer (highest voted) for the correct answer. – JeffC Jun 08 '18 at 12:47
1 Answers
0
Wherever it is, you can get it with input.getAttribute("value")
. You just need to select the input.
WebElement input = driver.findElement(By.tagName("app-datepicker"))
.findElement(By.tagName("input"));
String value = input.getAttribute("value");
I do so. app-datepicker
is an AngularJS component.

mahan
- 12,366
- 5
- 48
- 83
-
tried this: but returning a null value driver.findElementByXPath("//div[contains(@class,'form_input_Trader') and contains(@class,'form_meridian_date')]/input").getAttribute("value"); – bhargav porapu Jun 08 '18 at 10:32