I have found that the following works for me when working with iframes:
-
Manually create a new iframe TestObject as follows:
-Start Katalon Studio
-Right click on ‘Object Repository’ from the left tree
-Click New > Test Object
-Input Name= iframe01, click OK; iframe01 opens
-Input the Attributes or Xpath to locate iframe01
DO NOT tick the ‘Parent iframe’ property radio button
Save -
Manually create a new TestObject as follows:
-Start Katalon Studio
-Right click on ‘Object Repository’ from the left tree
-Click New > Test Object
-Input Name= testObject1, click OK; testObject1 opens
-Input the Attributes or Xpath to locate testObject1
DO NOT tick the ‘Parent iframe’ property radio button
Save
//Add the following to the body of the test case:
WebUI.switchToFrame(findtestObject('iframe01'), 30); //opens iframe01
WebUI.waitForElementVisible(findtestObject('testObject1'), 30);
WebUI.click(findtestObject('testObject1'));
//Other steps can go here...
WebUI.switchToDefaultContent(); //closes iframe01