Nothing too exciting here, just something I was chewing on for a while and wanted to write down. I’m testing a page that uses GreyBox to display modal windows. GreyBox puts the content in an iframe, so you have to do a little finagling to get at it. Most of the selenium rc methods that handle frames seem to require me to actually know something about the frame I’m looking at, like an id or a name or something. I dunno any of that crap, just use that damn iframe there.
Anyway, select_frame (I’m using the python bindings here) lets you use the “index” locator, so you can jump right in to the first frame. Then to get back out, there is the “relative” locator that lets you just move up one level. You end up with something like this:
# do stuff in the main window here
sel.click("the link you're clickin")
sel.select_frame('index=0')
# do stuff to the iframe here
sel.select_frame('relative=up')
# you're back in the main window
I don’t have all that solid a grasp on what’s going on around here, so I’m sure this only works in whatever bizarre edge case I have set up. Whatever, hopefully google will direct some poor soul here and I will end up making his day just that much brighter.