# Finding Element's xpath address

**URL:** <https://forum.katalon.com/t/finding-elements-xpath-address/8944>\
**Category:** Web Testing\
**Tags:** web-testing, katalon-studio\
**Created:** [January 19, 2018, 9:30am UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944 "2018-01-19T09:30:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roi\_Weinreb1](https://avatars.discourse-cdn.com/v4/letter/r/5daacb/32.png) [@Roi\_Weinreb1](https://forum.katalon.com/u/Roi_Weinreb1)\
**Post date:** [January 19, 2018, 9:30am UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/1 "2018-01-19T09:30:38Z")

</div>

Hello there,  
I’m trying to get an attribute of the small arrow next to ‘Date’ that is shown in the pic:

I used Katalon recorder to find the element’s xpath address and it gave me the following xpath:

```auto
"//div[5]/sort-direction/iron-icon[2]"

```

but this xpath is not enough because I need the “d” attribute that inside the ‘path’ tag (as you can see in the pic).  
I tried to modify the xpath like this :

```auto
"//div[5]/sort-direction/iron-icon[2]/svg/g/path"

```

but then I got an NoSuchElementException alert.

Any ideas of getting this attribute??

[last modified arrow.png](https://s3.amazonaws.com/katalon-forum/editor/ur/phm25amuxgyc.png)

---

<div class="post-metadata">

**Author:** ![B\_L](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/b_l/32/976_2.png) [@B\_L](https://forum.katalon.com/u/B_L)\
**Post date:** [January 24, 2018, 8:02pm UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/2 "2018-01-24T20:02:36Z")

</div>

depending on what you are trying to do…perhaps just record the actual column and use click to click the column for sorting.

you can also try something like this:  
//\*[@d=‘M7 1015 5 5-5z’]

---

<div class="post-metadata">

**Author:** ![Bartosz\_Budzik](https://avatars.discourse-cdn.com/v4/letter/b/f0a364/32.png) [@Bartosz\_Budzik](https://forum.katalon.com/u/Bartosz_Budzik)\
**Post date:** [January 24, 2018, 9:33pm UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/3 "2018-01-24T21:33:21Z")

</div>

you may try also with [https://chrome.google.com/webstore/detail/xpal-xpath-generator-test/lpfjogcaifigkimnlkepjlkfhpdhebap](https://chrome.google.com/webstore/detail/xpal-xpath-generator-test/lpfjogcaifigkimnlkepjlkfhpdhebap) tool. It generates great xpath range.

---

<div class="post-metadata">

**Author:** ![Ajay\_Kumar\_Khare](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@Ajay\_Kumar\_Khare](https://forum.katalon.com/u/Ajay_Kumar_Khare)\
**Post date:** [January 25, 2018, 11:03am UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/4 "2018-01-25T11:03:46Z")

</div>

Also you can refer this link to write dynamics xpath- [https://www.softwaretestingmaterial.com/dynamic-xpath-in-selenium/](https://www.softwaretestingmaterial.com/dynamic-xpath-in-selenium/)

**Or** by inspect element you can also find exact xpath, Just point your down arrow and copy -\> Copy Xpath.

---

<div class="post-metadata">

**Author:** ![Prince\_Kuhio](https://avatars.discourse-cdn.com/v4/letter/p/9de0a6/32.png) [@Prince\_Kuhio](https://forum.katalon.com/u/Prince_Kuhio)\
**Post date:** [January 25, 2018, 6:54pm UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/5 "2018-01-25T18:54:16Z")

</div>

Use Ranorex Selocity Chrome browser extension. It generates both xpath and css.

> **[XPath and CSS Selector Generator | Ranorex Selocity Chrome Extension](https://www.ranorex.com/selocity/browser-extension/)**
>
> Boost your efficiency and generate reliable Selenium CSS selectors as well as XPath selectors with the free Ranorex Selocity Chrome extension!

---

<div class="post-metadata">

**Author:** ![Jim\_Zhang](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Jim\_Zhang](https://forum.katalon.com/u/Jim_Zhang)\
**Post date:** [May 31, 2018, 8:09pm UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/6 "2018-05-31T20:09:28Z")

</div>

All above comments are not helpful to this issue. Katalon seems cannot access svg elements after I try different ways of xpath… Need help please.

---

<div class="post-metadata">

**Author:** ![Jim\_Zhang](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Jim\_Zhang](https://forum.katalon.com/u/Jim_Zhang)\
**Post date:** [May 31, 2018, 8:51pm UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/7 "2018-05-31T20:51:15Z")

</div>

Please try xpath by something like “//_[local-name() = ‘svg’]" for svg tag and then you can access svg inside element like "//div[5]/sort-direction/iron-icon[2]/_[local-name() = ‘svg’]/g/path”. Don’t trust on web spy since it won’t find anything about svg tag but the test can run with the xpath.

---

<div class="post-metadata">

**Author:** ![dasagrivamanu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dasagrivamanu/32/1392_2.png) [@dasagrivamanu](https://forum.katalon.com/u/dasagrivamanu)\
**Post date:** [January 23, 2019, 7:08pm UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/8 "2019-01-23T19:08:08Z")

</div>

You can use both the xpath or css locator scheme to the date arrow icon. Here is the step by step description to [use locators in selenium](https://www.techbeamers.com/findelement-and-findelements-commands-examples/).

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 23, 2019, 9:01pm UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/9 "2019-01-23T21:01:19Z")

</div>

In the attached image, I found the following tags in the target HTML,  
`<sort-direction>`  
`<iron-icon>`

These tag names are not usual tag names defined in the HTML4 or [HTML5 Specification](https://www.w3.org/TR/html5/semantics.html#semantics). I wondered what they are. I did a few searches and found the following page:

- [webcomponents.org - Discuss & share web components](https://www.webcomponents.org/introduction)

The page says:

> What are web components?  
> Web components are a set of web platform APIs that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps. Custom components and widgets build on the Web Component standards, will work across modern browsers, and can be used with any JavaScript library or framework that works with HTML.  
> Web components are based on existing web standards. Features to support web components are currently being added to the HTML and DOM specs, letting web developers easily extend HTML with new elements with encapsulated styling and custom behavior.

`<sort-direction>`, `<iron-icon>` — these tags seem to be custom HTML tags based on the Web Components supported by browsers as an experimenting feature.

On the other hand, WebDriver (+ Katalon Studio) is based on the classic HTML and DOM specs. I suppose that the Recorder of Katalon Studio can not find the custom HTML tags based on the new Web Components Spec because these are out of the scope of the classic HTML & DOM specs.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 23, 2019, 9:09pm UTC](https://forum.katalon.com/t/finding-elements-xpath-address/8944/10 "2019-01-23T21:09:22Z")

</div>

[Andrej\_Podhajsky](http://forum.katalon.com/u/Andrej_Podhajsky) has posted the following:

> [@Execute xpath functions from Katalon Studio](http://forum.katalon.com/t/execute-xpath-functions/11937):
>
> Hello, i was thinking how to execute xpath functions inside Katalon to we can use built-in capabilities of browser like count(), more than 1 objet on page directly in scripts. One way is to use selenium driver and capture outputs, but i find that way not “Katalon enough” so i write myself custom keyword that allows me to execute xpath functions defined eg. in testObjects (need some time to add direct to passing capability - if requested) for now, one can call this keyword to get number/string…

His code enables you to send an XPath expression contained in a TestObject to browser, and let browser evaluate the expression using browser’s XPath engine over the page’s DOM, and return the evaluation result from browser to Katalon.

This method might be effective to _the custom HTML tags based on the Web Components_ such as `<iron-icon>`

Sorry but I have not tried this approach yet.
