Skip to content

Instantly share code, notes, and snippets.

@bobsilverberg
Last active August 29, 2015 14:00
Show Gist options
  • Save bobsilverberg/11184964 to your computer and use it in GitHub Desktop.
Save bobsilverberg/11184964 to your computer and use it in GitHub Desktop.
# v1.3 requires a different wait
Wait(marionette=self.marionette, timeout=timeout)\
.until(lambda m: m.execute_script('return window.wrappedJSObject.AppWindowManager || window.wrappedJSObject.WindowManager'))
if self.marionette.execute_script('return window.wrappedJSObject.AppWindowManager') == 'None':
if self.is_android_build:
self.marionette.execute_async_script("""
window.addEventListener('mozbrowserloadend', function loaded(aEvent) {
if (aEvent.target.src.indexOf('ftu') != -1 || aEvent.target.src.indexOf('homescreen') != -1) {
window.removeEventListener('mozbrowserloadend', loaded);
marionetteScriptFinished();
}
});""", script_timeout=timeout*1000)
# TODO: Remove this sleep when Bug 924912 is addressed
time.sleep(5)
else:
# Wait for the AppWindowManager to have registered the frame as active (loaded)
locator = (By.CSS_SELECTOR, 'div.appWindow.active.render')
Wait(marionette=self.marionette, timeout=timeout, ignored_exceptions=NoSuchElementException)\
.until(lambda m: m.find_element(*locator).is_displayed())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment