Hi
How do we deal with the situation where the web element is in a frame - which is within an iFrame
When do ‘SwitchtoFrame’ - do we have to use the keyword for iFrame/Frame or both? I tried all 3 possibilities but it seems to not able to find the iFrame using any xpath/attruibutes.
Hi @anishas,
Remove the 5 second Delay.
Change the ‘Switch To Frame - frame_Contribution Receivables’ to 30 seconds or more.
Remove the second ‘Switch To Frame - frame’
Retry the test.
Alternatively this might help…
Create your self a new test object
Right click on Object Repository > New > Test Object
Create ‘testIframe’ for example
When I use the Object Spy - it identifies the object and iframe correctly
For the iFrame_Contribution Receivables - I cannot use the xpath ID (ext-gen5877) as a locator since the value changes with every run
And there is a frame within the iframe
So I have to SwitchTo ‘iFrame’ or ‘Frame’?
Why Katalon cannot find the Frame or iFrame?
Hi @anishas,
This might help you…
Update your ‘Iframe_Contribution_Receivables’ object as follows: You might need to play with the values. For example, if there is more than one iframe object on your page you could use (//frame)[1] or (//frame)[2] or (//frame)[3]… Using option two would allow you to pick the second iframe.
// Waits up-to 10 seconds to switch to iframe (increase wait time if needed).
WebUI.switchToFrame(findTestObject('Object Repository/Iframe_Contribution_Receivables'), 10)
// Your code goes here ...
WebUI.waitForElementPresent(findTestObject('Object Repository/NewInvoiceBtn'), 10)
WebUI.enhancedClick(findTestObject('Object Repository/NewInvoiceBtn'))
// Switches from iframe to main page
WebUI.switchToDefaultContent()
Some more question in continuation of iFrame issue
I seem to manage to switch to the iframe and find the object as well
Below are my steps
However, when I try to look up in my input field - it doesnt match any value. I expect that on setting the text “112006” - a drop down list is populated and I select from the list. What am I doing wrong here?
Hi @anishas, great news that the iFrame is now working for you… If you manually input 112006 what do u see? Also please include a screenshot of your html code and object you are working with.
Thank you so much for your help so far!!
Just wanted to provide more information about the same
This is my expected result when I enter the value ‘112006’ in the lookup field - this is not a drop down. User has to manually enter the value and the drop down list is auto populated from which user can select the value
However, in automation - what I get is - where the field just fails to find the value
Just to revise - my object is within a frame - which in turn is within an iframe as below
If I switched to iframe - iframe_AssetEntry - it wouldn’t work
So I switched to Frame - frame_AssetEntry
And I have set the iframe “iframe_Asset entry” to be a parent iframe for the frame “frame_AssetEntry”
And the object itself - input_Lookup - I have set to NOT have any parent object
I assume that since we are already in the frame - we no longer need to specify that the object - input_Lookup - is within a parent object. Not sure if my assumption is correct though!
And this is how it ends up finding the object input_Lookup
However, when I input the text ‘112006’ to start the lookup - it doesn’t find anything
Can I make a suggestion - try changing row 36 to use WebUI.sendKeys instead of setText. Using send keys is a better match to how the user enters text and some of these components are sensitive to how values are entered eg if some events are triggered by typing