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.
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.
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” runs upon, silently translates a " character in any post texts into “ and ”. That annoys programmers sometimes.
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.