'Switches focus between the webdriver windows.
Args:
- window_name: The name of the window to switch to.
- window_index: The index of the window handle to switch to.
If the method is called without arguments it switches to the
last window in the driver window_handles list.
In case only one window exists nothing effectively happens.
Usage:
page.switch_window(\'_new\')
page.switch_window(2)
page.switch_window()'

def switch_window(self, window_name=None, window_index=None):

    if ((window_name is not None) and (window_index is not None)):
        raise ValueError("switch_window    receives    the    window's    name    or    the    window's    index,    not    both.")
    if (window_name is not None):
        self.driver.switch_to.window(window_name)
    elif (window_index is not None):
        self.driver.switch_to.window(self.driver.window_handles[window_index])
    else:
        self.driver.switch_to.window(self.driver.window_handles[(-1)])
