Reputation: 245
Currently I am working with the following HTML snippet:
<div class="cardEntry">
<!-- Balance Block Section (R)-->
<div class="balanceBLock">
<ul>
<li class="balanceText">Actual Balance</li>
<li class="balance">
<strong id="155555520be0019actualBalance">$1.00</strong>
</li>
<li class="balanceText">Available Balance</li>
<li class="balance">
I am trying to get the balance: $1.00 using the XPath:
.//*[@id='155555520be0019actualBalance']
and then attempting to obtain the dollar value using the method .getText however this does not return anything.
I can identify the element just fine using this XPath but it does not return the dollar value with getText method.
Can someone explain how to obtain this value?
Thanks
Upvotes: 0
Views: 161
Reputation: 3927
Looks like id is dynamic here.. use xpath like below with partial id
//strong[contains(@id,'actualBalance')]
or else use
//li[. = 'Actual Balance']/following-sibling::li/strong
specified by alecxe in comment.
Upvotes: 1
Reputation: 4683
Try getAttribute() with any of the below values: "value", "innerText", "innerHTML"
Upvotes: 0