you are already handling frame.
[color=#FF0000:3cfr27o3]i<frame.size()[/color:3cfr27o3]
In first screenshot, number of frames displayed in this site are 11 and later i switch to frame 9 to perform some actions.
For same URL, after some time, number of frames displayed is 10. That means, frame size is varying dynamically.
In this scenario, can you please suggest whether it is correct to depend on frame size and switch into that particular frame??