|
30 | 30 | from seleniumbase.fixtures import xpath_to_css
|
31 | 31 | from selenium.webdriver.remote.webdriver import WebDriver
|
32 | 32 | from selenium.webdriver.common.by import By
|
| 33 | +from selenium.webdriver import ActionChains |
33 | 34 |
|
34 | 35 |
|
35 | 36 | class BaseCase(unittest.TestCase):
|
@@ -76,6 +77,26 @@ def click(self, selector, by=By.CSS_SELECTOR,
|
76 | 77 | else:
|
77 | 78 | self._demo_mode_pause_if_active(tiny=True)
|
78 | 79 |
|
| 80 | + def double_click(self, selector, by=By.CSS_SELECTOR, |
| 81 | + timeout=settings.SMALL_TIMEOUT): |
| 82 | + if selector.startswith('/') or selector.startswith('./'): |
| 83 | + by = By.XPATH |
| 84 | + element = page_actions.wait_for_element_visible( |
| 85 | + self.driver, selector, by, timeout=timeout) |
| 86 | + self._demo_mode_highlight_if_active(selector, by) |
| 87 | + pre_action_url = self.driver.current_url |
| 88 | + actions = ActionChains(self.driver) |
| 89 | + actions.move_to_element(element) |
| 90 | + actions.double_click(element) |
| 91 | + actions.perform() |
| 92 | + if settings.WAIT_FOR_RSC_ON_CLICKS: |
| 93 | + self.wait_for_ready_state_complete() |
| 94 | + if self.demo_mode: |
| 95 | + if self.driver.current_url != pre_action_url: |
| 96 | + self._demo_mode_pause_if_active() |
| 97 | + else: |
| 98 | + self._demo_mode_pause_if_active(tiny=True) |
| 99 | + |
79 | 100 | def click_chain(self, selectors_list, by=By.CSS_SELECTOR,
|
80 | 101 | timeout=settings.SMALL_TIMEOUT, spacing=0):
|
81 | 102 | """ This method clicks on a list of elements in succession.
|
|
0 commit comments