Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.7k points)

I have the following HTML:

<div id="imageholder>

    <svg>

        <g> <image href='blah.gif'> </g>

    </svg>

</div>

And I cannot seem to locate the svg with selenium IDE on firefox at all. I have tried:

//svg

//svg:svg

//*[name()='svg']

//*[namespace-uri()='http://www.w3.org/2000/svg']

None of them can locate my svg element. Sometimes I get the error:

error = TypeError: e.scrollIntoView is not a function

I'm using this as a means to use the locator in JUnit 4 testing if that helps.

1 Answer

0 votes
by (62.9k points)

The question is concerning XPath, however, if you will use CSS Selectors, that might be a lot of decipherable, like thus (Java)

WebElement image = driver.findElement(By.cssSelector("#imageholder > svg > g > image"));

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s Selenium automation online training

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...