Can't locate locate form input on the second iteration (looping csv)

Hello,

I am trying to run some tests on the reddit compose page with Katalon Recorder for chrome:
https://www.reddit.com/message/compose/

Here is my recorder script:

open | https://www.reddit.com/message/compose/ |
loadVars | Test DB - Sheet1.csv |
pause | | 1000
selectFrame | index=0 |
click | name=to |
type | name=to | ${Name}
type | name=subject | ${Subreddit}
type | xpath=//form[@id=‘compose-message’]/div[6]/div/div/div[2]/div/div/textarea | hello
click | id=send |
endLoadVars | |

The script works perfectly the first time through, however, on the second loop, it gets stuck with

[info] Executing: | selectFrame | index=0 | |

[info] Expand variable ‘index=0’ into ‘index=0’

[info] Executing: | click | name=to | |

[info] Wait until the element is found

[info] Cannot find element name=to after 1000ms switch to xpath=//input[@name=‘to’]

[info] Executing: | click | xpath=//input[@name=‘to’] | |

[info] Wait until the element is found

[info] Cannot find element xpath=//input[@name=‘to’] after 1000ms switch to xpath=//form[@id=‘compose-message’]/div/div/div/input

[info] Executing: | click | xpath=//form[@id=‘compose-message’]/div/div/div/input | |

[info] Wait until the element is found

[info] Cannot find element xpath=//form[@id=‘compose-message’]/div/div/div/input after 1000ms switch to xpath=//div/input

[info] Executing: | click | xpath=//div/input | |

[info] Wait until the element is found

[info] Cannot find element xpath=//div/input after 1000ms switch to xpath

[info] Executing: | click | xpath | |

[info] Wait until the element is found

[info] Cannot find element xpath after 1000ms switch to xpath=

[info] Executing: | click | xpath= | |

[info] Wait until the element is found

[info] Cannot find element xpath= after 1000ms switch to xpath=xpath=//input[@name=‘to’]

[info] Executing: | click | xpath=xpath=//input[@name=‘to’] | |

[error] Failed to execute ‘iterateNext’ on ‘XPathResult’: The result type is not an iterator.

[info] Time: Tue Sep 14 2021 16:28:07 GMT-0700 (Pacific Daylight Time) Timestamp: 1631662087807

[info] Test case failed

I suspect it has something to do with the iframe? But I’m not entirely sure how to handle this case. Any ideas would be greatly appreciated.

Sorry for the late reply,

Maybe try to add a selectFrame with the relative=parent locator at the end of your loop to get back to the parent frame.