Provided an xpath below:
<svg:image xlink:href="some.svg" class="holder-38" width="24" height="268" preserveAspectRatio="none" x="426.7" y="473" type="image/svg+xml" data-ember-action="" data-ember-action-12238="12238">
I am able to access this with xpath (without tag as '*'):
'//*[@class="holder-38"]'
But unable to access with tag as svg:image
:
'//svg:image[@class="holder-38"]'
How can I specify the tag here?
Try the following way to access tag_name.
To click on the element use
Action
Class.<svg:image>
The
<svg:image>
element includes images inside SVG documents. It can display raster image files or other SVG files. The only image formats SVG software must support are JPEG, PNG, and other SVG files. Animated GIF behavior is undefined.SVG files displayed with
<image>
are treated as an image where external resources aren't loaded, :visited styles aren't applied and they cannot be interactive. To include dynamic SVG elements, try<use>
with an external URL. To include SVG files and run scripts inside them, try<object>
inside of<foreignObject>
.xlink:href
The xlink:href attribute defines a link to a resource as a reference
<IRI>
. The exact meaning of that link depends on the context of each element using it.Solution
To
click()
on the desired element you need to induce WebDriverWait for the desiredelement_to_be_clickable
and you can use the following solution:Note : You have to add the following imports :