Mitul Patel
Mitul Patel

Reputation: 23

Testing of pre -filled text in a text box

I have a text box and some data gets pre-filled in that text-box.How to verify what text inside that text box.

HTML Code :-

<div id="blkinner_first_name_readonly" class="bhTextFieldWrapper">
<label class="blk_lbl" for="id_first_name_readonly">Your First Name</label>
<input id="id_first_name_readonly" class="bhTextField" type="text" disabled="disabled" value="" name="first_name_readonly">
</div>
</div>

Upvotes: 2

Views: 1600

Answers (1)

Saifur
Saifur

Reputation: 16201

Since you have not mentioned which binding you are using, I assume it's Java. If so the following should do the work

WebElement element = driver.findElement(By.id("id_first_name_readonly"));

//Find the attribute value which stores the value of auto field name

String name = element.getAttribute("value");

Upvotes: 1

Related Questions