Rahim
Rahim

Reputation: 15

Extracting text from svg using python and selenium

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

Upvotes: 0

Views: 419

Answers (2)

Nikasan
Nikasan

Reputation: 1

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")

Upvotes: 0

DRVaya
DRVaya

Reputation: 443

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

Upvotes: 1

Related Questions