Permalink
Browse files

Capture the two window handles for use

move switch_to_main_window into a separate method of base.py

change to use current_window_handle

fix muppetry
  • Loading branch information...
1 parent 569cf44 commit 35db833f35b800720e0ca915a07ee02be91db45b Zac committed May 16, 2012
Showing with 6 additions and 1 deletion.
  1. +5 −0 pages/webdriver/base.py
  2. +1 −1 pages/webdriver/sign_in.py
View
@@ -12,8 +12,13 @@ class Base(object):
def __init__(self, selenium, timeout=60):
self.selenium = selenium
self.timeout = timeout
+ self._main_window_handle = self.selenium.current_window_handle
+
if selenium.title != self._page_title:
for handle in selenium.window_handles:
selenium.switch_to_window(handle)
if selenium.title == self._page_title:
break
+
+ def switch_to_main_window(self):
+ self.selenium.switch_to_window(self._main_window_handle)
@@ -55,7 +55,7 @@ def click_next(self):
def click_sign_in(self):
"""Clicks the 'Sign In' button."""
self.selenium.find_element(*self._sign_in_locator).click()
- self.selenium.switch_to_window('')
+ self.switch_to_main_window()
def sign_in(self, email, password):
"""Signs in using the specified email address and password."""

0 comments on commit 35db833

Please sign in to comment.