Web element located by xpath not found - multiple frames

Hi team,

My application has multiple frames and parent and multiple child frames (it is a nighthemare). I am trying to find the hierarchy of the frames in order to get to the correct object. I am not using switchtoframe for now. However, I am having difficulty locating the objects (or the next-down frame).

Script:

WebUI.waitForElementVisible(findTestObject('Page_Retail Basic CSM PU/span_mainframe 1'), 0)
WebUI.waitForElementVisible(findTestObject('Page_Retail Basic CSM PU/span_mainframe 1.1'), 0)
WebUI.waitForElementVisible(findTestObject('Page_Retail Basic CSM PU/span_mainframe 1.1.1'), 0) //error

where:

span_mainframe 1 = /html/frameset/frameset[1]
span_mainframe 1.1 = //*[starts-with(@id,"USER")]
span_mainframe 1.1.1 = //*[@id="pane_"] <<< this is where the error occurs

Hierarchy of frameset before getting to the object itself:

Please see error below:

image.png

Screenshot3.PNG

Possibly you need to switch the current context to the frame . See https://docs.katalon.com/display/KD/[WebUI]+Switch+To+Frame

...WebUI.waitForElementVisible(findTestObject('Page_Retail Basic CSM PU/span_mainframe 1.1'), 0)WebUI.switchToFrame(findTestObject('Page_Retail Basic CSM PU/span_mainframe 1.1'), 5)WebUI.waitForElementVisible(findTestObject('Page_Retail Basic CSM PU/span_mainframe 1.1.1'), 0) 
1 Like

kazurayam said:

Possibly you need to switch the current context to the frame . See https://docs.katalon.com/display/KD/[WebUI]+Switch+To+Frame

...WebUI.waitForElementVisible(findTestObject('Page_Retail Basic CSM PU/span_mainframe 1.1'), 0)WebUI.switchToFrame(findTestObject('Page_Retail Basic CSM PU/span_mainframe 1.1'), 5)WebUI.waitForElementVisible(findTestObject('Page_Retail Basic CSM PU/span_mainframe 1.1.1'), 0) 

Thanks mate! You’re a saviour. It worked like a charm.