0

I would like to take the value using selenium from the text-box which is ready only and aria-live marked as off.

DOM as below:

<input autocomplete="off" class="abc" type="text" role="textbox" id="sumAccount" aria-describedby="sumAccount_describedby" tabindex="0" readonly="true" data-preview="true" aria-live="off">

In the webpage Summary of Account field is showing the value as "4567" ready only field

I have tried the below code to get the value, I am getting null value always:

string accNumber = driver.findElement(By.id("sumAccount")).getAttribute("title");
string accNumber = driver.findElement(By.id("sumAccount")).text();

Can any one help me to get the value?

Nitesh Singh
  • 385
  • 1
  • 3
  • 15
Sahul
  • 1

1 Answers1

0

To extract the value using Selenium from the <input> which is ready only and aria-live="off" you can use the following solution:

string accNumber = driver.findElement(By.id("sumAccount")).getAttribute("value");
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Still getting value as null "System.NullReferenceException: 'Object reference not set to an instance of an object.' summaryAccount was null." – Sahul Feb 20 '21 at 12:37
  • Basic question, when the DOM doesn't have attribute called "value" how selenium to get the text in the getAttribute("value"). – Sahul Feb 20 '21 at 12:40