def __init__(self, model: LayoutDOM, driver: WebDriver, output_file_url: str, has_no_console_errors: HasNoConsoleErrors) -> None: super().__init__(model, driver, output_file_url, has_no_console_errors) self.canvas = self._driver.find_element_by_tag_name('canvas') wait_for_canvas_resize(self.canvas, self._driver)
def __init__(self, modify_doc, driver, bokeh_app_info, has_no_console_errors): self._driver = driver self._has_no_console_errors = has_no_console_errors self._app_url, self.message_test_port = bokeh_app_info(modify_doc) time.sleep(0.1) self._driver.get(self._app_url) self.init_results() self.canvas = self._driver.find_element_by_tag_name('canvas') wait_for_canvas_resize(self.canvas, self._driver)
def __init__(self, modify_doc, driver, bokeh_app_info, has_no_console_errors): self._driver = driver self._has_no_console_errors = has_no_console_errors self._app_url, self.message_test_port = bokeh_app_info(modify_doc) time.sleep(0.1) self._driver.get(self._app_url) self.init_results() self.canvas = self._driver.find_element_by_tag_name('canvas') wait_for_canvas_resize(self.canvas, self._driver)
def perform_box_selection(selenium, start, end, hold_shift=False): canvas = selenium.find_element_by_tag_name('canvas') wait_for_canvas_resize(canvas, selenium) actions = ActionChains(selenium) if hold_shift: actions.key_down(Keys.LEFT_SHIFT) actions.move_to_element_with_offset(canvas, *start) actions.click_and_hold() actions.move_by_offset(*end) actions.release() if hold_shift: actions.key_up(Keys.LEFT_SHIFT) actions.perform()
def pan_plot(selenium, pan_x=None, pan_y=None): canvas = selenium.find_element_by_tag_name('canvas') wait_for_canvas_resize(canvas, selenium) # Enable the pan tool pan_buttons = selenium.find_elements_by_css_selector( '.bk-button-bar-list[type="pan"] .bk-toolbar-button') pan_button = pan_buttons[0] if 'active' not in pan_button.get_attribute('class'): pan_button.click() actions = ActionChains(selenium) actions.move_to_element_with_offset(canvas, 200, 200) actions.click_and_hold() actions.move_by_offset(pan_x, pan_y) actions.release() actions.perform()
def zoom_plot(selenium): canvas = selenium.find_element_by_tag_name('canvas') wait_for_canvas_resize(canvas, selenium) # Enable the box zoom tool pan_buttons = selenium.find_elements_by_css_selector( '.bk-button-bar-list[type="pan"] .bk-toolbar-button') zoom_button = pan_buttons[1] if 'active' not in zoom_button.get_attribute('class'): zoom_button.click() actions = ActionChains(selenium) actions.move_to_element_with_offset(canvas, 30, 30) actions.click_and_hold() actions.move_by_offset(200, 200) actions.release() actions.perform()
def __init__(self, model, driver, output_file_url, has_no_console_errors): super().__init__(model, driver, output_file_url, has_no_console_errors) self.canvas = self._driver.find_element_by_tag_name('canvas') wait_for_canvas_resize(self.canvas, self._driver)
def __init__(self, model, driver, output_file_url, has_no_console_errors): super(_SinglePlotPage, self).__init__(model, driver, output_file_url, has_no_console_errors) self.canvas = self._driver.find_element_by_tag_name('canvas') wait_for_canvas_resize(self.canvas, self._driver)