Katalon SVG Xpath

Hello guys,

I am having trouble clicking on an element which is under the svg tag.

Have to click on an element which is under a SVG tag but there are several layers within it as shown below. (The element concerning me is highlighted with Red)

ask1

Upon expanding the g tag, it has several other tags within it:

ask2

And when I finally expand it, the element that i want to click has the following attributes as shown below in the highlighted part:

My xpath is as follows:

//[local-name()=“svg”]/[local-name()=“g” and @class=“sapHpaJourneyChartChannelData”]/[local-name()=“g” and @class=“sapHpaJourneyChannelData”]/[local-name()=“g” and @class=“sapHpaJourneyItemIconGroup” and @x=“110” and @y=“178.801703163017”]

which is unable to locate the xpath element. Since there is no id associated with this SVG tag, i am only taking the class attribute and then the coordinates of the element.

Am I missing out here on something?

Thanks in advance,
Saumil

I think there is another post relating to svg and I recall @Russ_Thomas offers some advices. Could you link to that answer here Russ ?

@ThanhTo Sorry, I don’t recall the post you’re referring to.

@saumil.sah, I can give you a CSS path (I’m not an XPath guy, sorry).

#__journey0-container g.sapHpaJourneyItemIconGroup text:nth-child(4)

In English:

  1. Find the element with ID __journey0-container
  2. Find desendant g elements with class sapHpaJourneyItemIconGroup
  3. Find desendant (child) text elements and take the fourth one.

If you switch to using CSS instead of XPath in your Test Object definition, that CSS should allow you to use WebUI.click(...).

same issue closed

Appreciate your help. Someone else suggested me another solution in the forum and it worked well! But, will try out this method as well :slight_smile: