I think this is probably best done when the browser object is created, rather than each iteration of this loop.  Could you move it to the `__construct` method?