def InvokeBrowser(path): """Invoke the IE browser. Args: path: full path to browser Returns: A tuple of (main window, process handle, address bar, render_pane, tab_window) """ # Invoke IE (ieproc, iewnd) = windowing.InvokeAndWait(path) # Get windows we'll need for tries in xrange(10): try: address_bar = windowing.FindChildWindow( iewnd, "WorkerW|Navigation Bar/ReBarWindow32/" "Address Band Root/ComboBoxEx32/ComboBox/Edit") render_pane = windowing.FindChildWindow( iewnd, "TabWindowClass/Shell DocObject View") tab_window = windowing.FindChildWindow( iewnd, "CommandBarClass/ReBarWindow32/TabBandClass/DirectUIHWND") except IndexError: time.sleep(1) continue break return (iewnd, ieproc, address_bar, render_pane, tab_window)
def InvokeBrowser(path): """Invoke the Chrome browser. Args: path: full path to browser Returns: A tuple of (main window, process handle, address bar, render pane) """ # Reuse an existing instance of the browser if we can find one. This # may not work correctly, especially if the window is behind other windows. # TODO(jhaas): make this work with Vista wnds = windowing.FindChildWindows(0, "Chrome_XPFrame") if len(wnds): wnd = wnds[0] proc = None else: # Invoke Chrome (proc, wnd) = windowing.InvokeAndWait(path) # Get windows we'll need address_bar = windowing.FindChildWindow(wnd, "Chrome_AutocompleteEdit") render_pane = GetChromeRenderPane(wnd) return (wnd, proc, address_bar, render_pane)
def InvokeBrowser(path): """Invoke the Firefox browser. Args: path: full path to browser Returns: A tuple of (main window, process handle, render pane) """ # Reuse an existing instance of the browser if we can find one. This # may not work correctly, especially if the window is behind other windows. wnds = windowing.FindChildWindows(0, "MozillaUIWindowClass") if len(wnds): wnd = wnds[0] proc = None else: # Invoke Firefox (proc, wnd) = windowing.InvokeAndWait(path) # Get the content pane render_pane = windowing.FindChildWindow( wnd, "MozillaWindowClass/MozillaWindowClass/MozillaWindowClass") return (wnd, proc, render_pane)
def GetBrowser(path): """Invoke the Firefox browser and return the process and window. Args: path: full path to browser Returns: A tuple of (process handle, render pane) """ if not path: path = DEFAULT_PATH # Invoke Firefox (proc, wnd) = windowing.InvokeAndWait(path) # Get the content pane render_pane = windowing.FindChildWindow( wnd, "MozillaWindowClass/MozillaWindowClass/MozillaWindowClass") return (proc, wnd, render_pane)