If a .w has a child window, FIRST-CHILD can sometimes return the frame from the child window instead of a frame from the .w. Is there a way to immediately select a frame that belongs to the .w in generic way?
There's no attribute which returns only frames and not child windows. This is something you have to manage yourself.