shashi j shashi j - 1 year ago 144
Java Question

How to do get text of read only text from Selenium webdriver java

Application has a

text filed
which displays dynamically changes, after getting value of the weight of a product,that is read only, I am not able to read the values from it. Here is the code:

WebElement input = driver.findElement(getLocator("Weight1Value"));

Answer Source

You can try JavascriptExecutor if the above is not working

JavascriptExecutor jse = (JavascriptExecutor)driver;
String Text = (String) jse.executeScript("return arguments[0].value;",driver.findElement(getLocator("Weight1Value"));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download