0

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

4
  • What if you make the expression more specific: //li[. = 'Actual Balance']/following-sibling::li/strong? Commented Jun 30, 2016 at 23:57
  • 1
    Please post the code you are using. What are you getting as a result? We don't want to guess what your code was or why you might not be getting the result you expect. Commented Jul 1, 2016 at 1:16
  • I think you have to use some wait before finding the element ... Commented Jul 1, 2016 at 5:22
  • @alecxe this expression has 8 matching nodes I am looking for one that specifically matches one of the 8 Commented Jul 7, 2016 at 16:41

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Try getAttribute() with any of the below values: "value", "innerText", "innerHTML"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.