I am trying to capture and store some text that appears inside of an svg element such as
<svg>
<g>
<text>Value to get</text>
</g>
</svg>
I have a method that I am using and it works for other elements, but the Selenium WebElement class method getText does not return any text for an svg element such as above.
Here is what my xpath looks like for the above example
//*[local-name()='g']//*[local-name()='text']
I am able to use findElement(By.xpath(myXpath)), but then when I call .getText() on it, it does not return any value and it also does not throw any errors.
Is there something I am doing wrong, or possibly an alternative method?
Also something interesting to note, the above approach worked fine on a Windows 7 machine, but not on Mac.