All the SVG elements may have same attribute values or the values that may change dynamically.It is not possible to identify the elements based on Tag in xpath expression(since these tags may not be identified by dom as they are not html tags.)
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width='300px' height='300px'>
<title>Small SVG example</title>
<circle cx='120' cy='150' r='60' style='fill: gold;'> <animate attributeName='r' from='2' to='80' begin='0' dur='3' repeatCount='indefinite' /></circle>
<polyline points='120 30, 25 150, 290 150' stroke-width='4' stroke='brown' style='fill: none;' />
<polygon points='210 100, 210 200, 270 150' style='fill: lawngreen;' />
<text x='60' y='250' fill='blue'>Hello, World!</text>
</svg> The above is the SVG used to Create a Circle,polygon and Polyline as shown in the graphics above.In order to identify a circle the Xpath expression should be framed as
if we specify
The first syntax (i.e. //*[@cx ='120']) doesn't highlights the element in the displayed chart. I am using Selenium IDE 1.10.0.
ReplyDeleteI am stuck in identifying SVG elements in my application. Even css selectors are not working. Could you please help me with that.
Thank you Kumar.
Have you tried with an xpath expression like:
Delete//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="circle"]
I could get the element as you described above. But when I tried to click on the element. The click does not work on IE. Other browsers are working fine with it.
ReplyDeleteDo you have any solutions for that issue?
Regards
Manish
Manish,
DeleteI am trying to click on SVG image through xpath and Mouse events but the click does not working on chrome, Firefox browser and IE. Please help me, Do you have any solution?
Please provide your contact details, i will reach you.
Thanks your help.
I am using leaflet for drawing a polygon on a map. I have the svg for the leaflet that needs to be drawn. I am thinking of automating the process using Robotframework or Selenium Webdriver. Can you suggest some help?
ReplyDeleteHi, I am trying to click on SVG image through xpath and Mouse events but the click does not working on chrome, Firefox browser. Please help me, Do you have any solution?
ReplyDeleteRegards,
Gopi
Hi Team,
ReplyDeleteI am trying to hover over the SVG element such that the corresponding hover card is displayed. I tried with xpath and css selectors.I need your help
I have the screenshots for the source code. How can I show you
ReplyDeleteHi , How to acces the svg element if its available in .svg file.
ReplyDeleteSample HTML code
id="svgpanel" style="height:89%;width:100%; border-style: ridge; background-color: #dbe9ee;position: absolute;">
I was struggling getting svg images to show up in blogger. Your post helped tremendously. Thanks!
ReplyDelete