0

enter image description hereenter image description hereenter image description hereenter image description here

i came up with this xpath:-"//[local-name()='text' and @style='text-anchor: middle; fill: rgb(0, 32, 96); font-family: Calibri; font-size: 40px; white-space: pre;']/[local-name()='title']"

which gives me 3 element that i need t extract but couldn't get more unique then this. Can someone help.

Thanks

8
  • 1
    You should share raw HTML comment rather than sharing image. And also highlight which 3 elements it’s is returning. meta.stackoverflow.com/questions/285551/… Commented Sep 7, 2020 at 5:38
  • Can you try this : //svg[@class='card']//title Commented Sep 7, 2020 at 5:53
  • its hard to share the whole source i can share the 3 elemnts i get Commented Sep 7, 2020 at 5:59
  • for svg its name or local name that works Commented Sep 7, 2020 at 6:00
  • At least you can share HTML you have shared in image in text format. Also share HTML of other two elements identified. Commented Sep 7, 2020 at 6:32

2 Answers 2

1

If at all you are trying to find only these 3 elements/amount fields, I would suggest you can try the following CSS Selectors, should work.

svg[class='card'][aria-label*='PaymentReceived'] title


svg[class='card'][aria-label*='Change%'] title


svg[class='card'][aria-label*='ChangeFromPrevious'] title
Sign up to request clarification or add additional context in comments.

1 Comment

Your Xpath - //[local-name()='text' and @style='text-anchor: middle; fill: rgb(0, 32, 96); font-family: Calibri; font-size: 40px; white-space: pre;']/[local-name()='title'] seems to be quite fragile and its very likely that there can be a placeholder element that's returning you the 3 elements but they would not be populated. In that case, choosing the label can be preferred as it might as well be the element that you need data from and would be populated.
0

Screen from console in browser

Try to use:

var element = document.querySelectorAll('svg>title')
element[9].textContent

in selenide with Java I use it like this:

element.getAttribute("textContent").contains("your text")

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.