tanvi_agarwal
12 years agoOccasional Contributor
How to grab the text on the web page?
Hi,
I am recording tests where I create a booking and a unique ID gets generated at the end of the booking.
How to store that ID in a variable?
Please could someone suggest.
Thanks,
Tanvi
I am recording tests where I create a booking and a unique ID gets generated at the end of the booking.
How to store that ID in a variable?
Please could someone suggest.
Thanks,
Tanvi
- Hi Tanvi,
The fastest way is to ask develop to add a class or a id to the cell itself. For example:
<td>Your ID:</td>
<td id="yourid">83575</td>
Now just search for an object which idStr is "yourid" and retrieve its textContent.
Other way is to retrieve the "Your ID" cell, and do something like that:
theId = yourIdObject.Parent.Cell(x, y).innerText;
Where yourIdObject is the cell with textContent "Your ID", x is yourIdObject RowIndex property, and y is yourIdObject ColumnIndex + 1
Hope it helped!