|
|
|
|
@ -5,6 +5,8 @@ from selenium.webdriver.common.keys import Keys
|
|
|
|
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
|
|
|
from selenium.webdriver.support import expected_conditions as EC
|
|
|
|
|
|
|
|
|
|
from contextlib import contextmanager
|
|
|
|
|
|
|
|
|
|
pjoin = os.path.join
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -127,3 +129,15 @@ class Notebook:
|
|
|
|
|
def add_markdown_cell(self, index=-1, content="", render=True):
|
|
|
|
|
self.add_cell(index, cell_type="markdown")
|
|
|
|
|
self.edit_cell(index=index, content=content, render=render)
|
|
|
|
|
@contextmanager
|
|
|
|
|
def new_window(browser, selector=None):
|
|
|
|
|
"""Creates new window, switches you to that window, waits for selector if set.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
initial_window_handles = browser.window_handles
|
|
|
|
|
yield
|
|
|
|
|
new_window_handle = next(window for window in browser.window_handles
|
|
|
|
|
if window not in initial_window_handles)
|
|
|
|
|
browser.switch_to_window(new_window_handle)
|
|
|
|
|
if selector is not None:
|
|
|
|
|
wait_for_selector(browser, selector)
|
|
|
|
|
|