Switch to Frame does not work

It’s the next line that seems to be failing.

Please post the relevant lines from the console log.

And read this: