Creating testObject with parent iframe

Hi,

Can someone help me how to declare testobject with parent iframe in script?
I know how to create simple text object like:
TestObject naujas = new TestObject()
naujas.addProperty(‘xpath’, ConditionType.EQUALS, “id(‘bitbag-ckeditor’)”, true)

Where and how to add setting that it has parent iframe?

Hi Edita

Did you try switching to the iframe first and then creating the TestObject?

WebUI.switchToFrame(findTestObject('my_iframe'), TIMEOUT_SECONDS)

TestObject naujas = new TestObject()
naujas.addProperty('xpath', ConditionType.EQUALS, "id('bitbag-ckeditor')", true)

// other steps...

If that does not work, I would try adding a dummy TestObject with the parent frame set up in advance, then use modifyObjectProperty to create your TO. Something like this:

TestObject naujas = findTestObject("dummy_iframe_object")
WebUI.modifyObjectProperty(naujas, 'xpath, ConditionType.EQUALS, "id('bitbag-ckeditor')", true)

https://docs.katalon.com/katalon-studio/docs/webui-modify-object-property.html

Thanks a lot it helped. But another problem appear. Now I can`t go back to default content. This method WebUI.switchToDefaultContent() not working.

Sorry, my mistake. Missed some symbols :smiley: everything work fine :slight_smile:

1 Like

Excellent!