def new_window(session):
    """Open new window and return the window handle."""
    windows_before = session.window_handles
    name = session.execute_script("window.open()")
    assert len(session.window_handles) == len(windows_before) + 1
    new_windows = session.window_handles - windows_before
    return new_windows.pop()