Unable to click on the element in side the nested iframe

The Element is inside 2 nested frames.
frame1 = iframe[@id=‘Main-1’];
frame2 = iframe[@id=‘Second-1’];
Element ID = xyz
Last time I used below code for single iframe and it work
dexecAndWait document.querySelector(“iframe[id=Main]”).contentDocument.querySelector(“button[id=abc]”).click();
Can anyone help on this. Thanks

I could resolve it by having below code.

execAndWait document.querySelector(“iframe[id=First iframe ID]”).contentDocument.querySelector(“iframe[id=Second iframe ID]”).contentDocument.querySelector(“element ID”).click();