| 92 | pass |
| 93 | |
| 94 | def click_modal(self, button_text, docker=False): |
| 95 | time.sleep(0.5) |
| 96 | # Find active dialog in case of multiple dialog |
| 97 | # & click on that dialog |
| 98 | |
| 99 | # In case of react dialog we use different xpath |
| 100 | if docker: |
| 101 | modal_button = self.find_by_css_selector( |
| 102 | ".dock-fbox button[data-label='{}']".format(button_text)) |
| 103 | else: |
| 104 | modal_button = self.find_by_css_selector( |
| 105 | ".MuiDialog-root button[data-label='{}']".format(button_text)) |
| 106 | |
| 107 | self.click_element(modal_button) |
| 108 | |
| 109 | # Wait for the dialog backdrop to fade out so subsequent clicks |
| 110 | # are not intercepted by the closing modal. MUI v7 leaves the |
| 111 | # backdrop in the DOM for ~300ms while the close animation runs. |
| 112 | try: |
| 113 | WebDriverWait(self.driver, 5).until( |
| 114 | EC.invisibility_of_element_located( |
| 115 | (By.CSS_SELECTOR, ".MuiDialog-backdrop"))) |
| 116 | except TimeoutException: |
| 117 | pass |
| 118 | |
| 119 | def add_server(self, server_config): |
| 120 | server_group_node = \ |