# Find element by XPath

**URL:** <https://discuss.appium.io/t/find-element-by-xpath/8263>\
**Category:** Support\
**Created:** [February 1, 2016, 1:59pm UTC](https://discuss.appium.io/t/find-element-by-xpath/8263 "2016-02-01T13:59:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Zainy](https://discuss.appium.io/letter_avatar_proxy/v4/letter/a/df788c/32.png) [@Ahmed\_Zainy](https://discuss.appium.io/u/Ahmed_Zainy)\
**Post date:** [February 1, 2016, 1:59pm UTC](https://discuss.appium.io/t/find-element-by-xpath/8263/1 "2016-02-01T13:59:36Z")

</div>

I try to find specific element by specific XPath which have specific index 3  
  
when i try to make this code  
`driver.FindElement(By.XPath("//android.widget.EditText[@index='3']")).SendKeys("1234");`

I got this exception

`{"An element could not be located on the page using the given search parameters."}`

How i can fix this ?

---

<div class="post-metadata">

**Author:** ![Venkatesh](https://discuss.appium.io/user_avatar/discuss.appium.io/venkatesh/32/5358_2.png) [@Venkatesh](https://discuss.appium.io/u/Venkatesh)\
**Post date:** [February 1, 2016, 3:17pm UTC](https://discuss.appium.io/t/find-element-by-xpath/8263/2 "2016-02-01T15:17:53Z")

</div>

could be that xPath changes at run time, you can check that with Appium Inspector.

---

<div class="post-metadata">

**Author:** ![namannigam14](https://discuss.appium.io/letter_avatar_proxy/v4/letter/n/9fc348/32.png) [@namannigam14](https://discuss.appium.io/u/namannigam14)\
**Post date:** [February 2, 2016, 3:40am UTC](https://discuss.appium.io/t/find-element-by-xpath/8263/3 "2016-02-02T03:40:58Z")

</div>

[http://stackoverflow.com/questions/35132830/find-element-in-appium](http://stackoverflow.com/questions/35132830/find-element-in-appium) do you own this question as well? Seems like a way is suggested in the solution on SO.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Zainy](https://discuss.appium.io/letter_avatar_proxy/v4/letter/a/df788c/32.png) [@Ahmed\_Zainy](https://discuss.appium.io/u/Ahmed_Zainy)\
**Post date:** [February 2, 2016, 8:39am UTC](https://discuss.appium.io/t/find-element-by-xpath/8263/4 "2016-02-02T08:39:02Z")

</div>

The problem solved by using the following code :  
`var webs = driver.FindElementsByClassName("android.widget.EditText"); webs[3].SendKeys("1234");`

---

<div class="post-metadata">

**Author:** ![Christopher\_Graham](https://discuss.appium.io/user_avatar/discuss.appium.io/christopher_graham/32/440_2.png) [@Christopher\_Graham](https://discuss.appium.io/u/Christopher_Graham)\
**Post date:** [February 2, 2016, 2:51pm UTC](https://discuss.appium.io/t/find-element-by-xpath/8263/5 "2016-02-02T14:51:11Z")

</div>

I would like to suggest that you pull the page XML and validate your XPATH construction with this online tool: [http://www.freeformatter.com/xpath-tester.html](http://www.freeformatter.com/xpath-tester.html) Should help you moving forward to better understand if your XPATH is correct and will function properly.

---

<div class="post-metadata">

**Author:** ![artkoshelev](https://discuss.appium.io/user_avatar/discuss.appium.io/artkoshelev/32/1154_2.png) [@artkoshelev](https://discuss.appium.io/u/artkoshelev)\
**Post date:** [February 6, 2016, 1:38pm UTC](https://discuss.appium.io/t/find-element-by-xpath/8263/6 "2016-02-06T13:38:33Z")

</div>

use “[//android.widget.EditText](https://android.widget.EditText)[3]”
