# Get XPath value from xml file

**URL:** <https://forum.katalon.com/t/get-xpath-value-from-xml-file/11981>\
**Category:** Mobile Testing\
**Tags:** mobile-testing, katalon-studio\
**Created:** [July 11, 2018, 8:50am UTC](https://forum.katalon.com/t/get-xpath-value-from-xml-file/11981 "2018-07-11T08:50:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayoub\_dali](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@ayoub\_dali](https://forum.katalon.com/u/ayoub_dali)\
**Post date:** [July 11, 2018, 8:50am UTC](https://forum.katalon.com/t/get-xpath-value-from-xml-file/11981/1 "2018-07-11T08:50:55Z")

</div>

I’m trying to get editText XPath from the xml file and use it in my test script  
When I spy the editText object I get this XPath

//hierarchy/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.EditText[1]

But when I try to get the Xpath form the xml file I get

/ScrollView[@xmlns:android=“[http://schemas.android.com/apk/res/android"\]/LinearLayout\[@android:orientation=“vertical”\]/android.support.design.widget.TextInputLayout\[@android:layout\_width=“match\_parent”\]/EditText\[@android:id="@+id/input\_email](http://schemas.android.com/apk/res/android%22%5C%5D/LinearLayout%5C%5B@android:orientation=%22vertical%22%5C%5D/android.support.design.widget.TextInputLayout%5C%5B@android:layout%5C_width=%22match%5C_parent%22%5C%5D/EditText%5C%5B@android:id=%22@+id/input_email)”]

and when I try to use it I get

Test Cases/xpath test FAILED because (of) org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.

Is there any way to reform the second Xpath and get a result like the first one ?

---

<div class="post-metadata">

**Author:** ![albert.vu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/albert.vu/32/20595_2.png) [@albert.vu](https://forum.katalon.com/u/albert.vu)\
**Post date:** [August 8, 2022, 7:03am UTC](https://forum.katalon.com/t/get-xpath-value-from-xml-file/11981/2 "2022-08-08T07:03:57Z")

</div>

Archived on August 8, 2022, 7:03am UTC


