# Unable to Identify Input Element

**URL:** <https://forum.katalon.com/t/unable-to-identify-input-element/124774>\
**Category:** Web Testing\
**Tags:** web-testing\
**Created:** [March 18, 2024, 9:44am UTC](https://forum.katalon.com/t/unable-to-identify-input-element/124774 "2024-03-18T09:44:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wirepi106](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/wirepi106/32/23870_2.png) [@wirepi106](https://forum.katalon.com/u/wirepi106)\
**Post date:** [March 18, 2024, 9:44am UTC](https://forum.katalon.com/t/unable-to-identify-input-element/124774/1 "2024-03-18T09:44:47Z")

</div>

Hi All,

I am currently facing an issue regarding querying out the input tag element within the a tag element with a base structure of something like this:

```auto
<div id="abc">
  <a class="hello world">
    <input id="upload" name="upload_file" type="file">
  </a>
</div>

```

Do note that the above is within the iframe too but I am able to retrieve the a button directly using XPath: Selected Locator - //a[@class=‘hello world’]

I tried to do:

- //a[@class=‘hello world’//input
- //a[@class=‘hello world’//input[1]
- //input[@id=“upload”]

but unsure why these are not working.

Edit: I have also added the function `WebUI.waitForElementVisible()`, the response received was: Object ‘Object Repository/testSelectFileAttachmentBtn’ is not visible after 10 second(s). I have changed the duration to 20, 30, 50 seconds and still unable to identify the input element.

Thank you very much for your time.

---

<div class="post-metadata">

**Author:** ![mwarren04011990](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/mwarren04011990/32/26024_2.png) [@mwarren04011990](https://forum.katalon.com/u/mwarren04011990)\
**Post date:** [March 18, 2024, 1:01pm UTC](https://forum.katalon.com/t/unable-to-identify-input-element/124774/2 "2024-03-18T13:01:20Z")

</div>

Post the HTML

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [March 18, 2024, 4:31pm UTC](https://forum.katalon.com/t/unable-to-identify-input-element/124774/3 "2024-03-18T16:31:15Z")

</div>

If you have an `<iframe>`, you have to [switchToFrame()](https://docs.katalon.com/katalon-studio/keywords/keyword-description-in-katalon-studio/web-ui-keywords/webui-switch-to-frame) first before you do anything within it.

---

<div class="post-metadata">

**Author:** ![wirepi106](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/wirepi106/32/23870_2.png) [@wirepi106](https://forum.katalon.com/u/wirepi106)\
**Post date:** [March 19, 2024, 1:45am UTC](https://forum.katalon.com/t/unable-to-identify-input-element/124774/4 "2024-03-19T01:45:56Z")

</div>

Hi grylion54, thanks for your response. I have tried to use the `WebUI.switchToframe()` function as well but didn’t work out. I have also tried setting the iframe to the parent iframe of the object repository as another alternative but it does not work too.

---

<div class="post-metadata">

**Author:** ![wirepi106](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/wirepi106/32/23870_2.png) [@wirepi106](https://forum.katalon.com/u/wirepi106)\
**Post date:** [March 19, 2024, 1:46am UTC](https://forum.katalon.com/t/unable-to-identify-input-element/124774/5 "2024-03-19T01:46:12Z")

</div>

Hi mwarren04011990, thanks for your response. I have just edited the HTML in the original post.

---

<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:** [March 19, 2024, 2:05am UTC](https://forum.katalon.com/t/unable-to-identify-input-element/124774/6 "2024-03-19T02:05:45Z")

</div>

Your XPath expression is wrong:

> [@wirepi106](#):
>
> `//a[@class=‘hello world’//input`

right:

`//a[@class='hello world']//input`

you need a closing bracket `]`

And the following expression is even better

`//a[contains(@class, 'hello') and contains(@class, 'world')]/input`

---

<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:** [March 19, 2024, 2:07am UTC](https://forum.katalon.com/t/unable-to-identify-input-element/124774/7 "2024-03-19T02:07:45Z")

</div>

> [@wirepi106](#):
>
> `//input[@id=“upload”]`

I have a doubt about the quotation characters here.

Do you have `“` and `”` here, or a pair of `"` characters?

These are different characters, you know.

* * *

The Discourse, the forum software which “[forum.katalon.com](http://forum.katalon.com)” runs upon, silently translates a `"` character in any post texts into `“` and `”`. That annoys programmers sometimes.

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [March 19, 2024, 2:09am UTC](https://forum.katalon.com/t/unable-to-identify-input-element/124774/8 "2024-03-19T02:09:43Z")

</div>

> [@wirepi106](#):
>
> - //a[@class=‘hello world’//input
> - //a[@class=‘hello world’//input[1]
> - //input[@id=“upload”]

The first two of these pathways have a little bit of an _oops_. In the first one, you are missing the “closing” square parenthesis, like: `//a[@class='hello world']/input` and I removed the second set of slashes. Since the `<input>` is a **direct** child of the `<a>`, only one slash is necessary.  
For your second one, same as above: `//a[@class='hello world']/input[1]` and I again removed the second set of slashes.  
And for the third one, this is good as is, and is my preference: `//input[@id='upload']`, but I might rewrite it since you are using the `<id>` attribute as: `id('upload')`

Again, if this object is a “child” of an `<iframe>`, in other words if you go **up** a heirarchy tree and would encounter the `<iframe>`, then you must account for it first with a **switch to frame** and then you can load your file to the **input**. Note though if you go up the tree and **over** to encounter the frame, then you do NOT need to account for it.
