How to get Currentpage URL for the iframe?


My application page contains multiple iframes , i want to know currently i were in which Iframe .

If i used WebUI.getUrl() , it only returns the aspx page of the selected application screen .

FYR, Please find the attached screenshot for the application screen

Please find the attached screenshot for executed output

That’s a very vague question. When you say “i want to know currently i were in which Iframe” what is it you want to know? Where the focus is? Where a given test element resides?

It’s good that you posted a screenshot of the page and a screenshot of Katalon. But I’m guessing we’ll need to see the underlying HTML to go along with a more precise question.

As Russ has said, we will probably need to see the HTML for the iframe you are working with. However, as you’ve seen, WebUI.getUrl() just returns the current url as seen in the address bar. With iframes, the URL of the embedded page is usually presented as an attribute of the iframe element:

In my case above, it’s in the “src” attribute for the iframe element. So you can get this value just as you would with any other attribute value:

String iframeUrl = WebUI.getAttribute(findTestObject('path/to/iframe/object'), 'src');

However, it would still be nice to see your HTML, mainly to ensure that you’re not working with an embedded iframe, in which case you may need to switch to one or more ancestor frames first before this would work.