| 423 | pdb.set_trace() # pylint: disable=forgotten-debug-statement |
| 424 | |
| 425 | def select_dcc_dropdown(self, elem_or_selector, value=None, index=None): |
| 426 | dropdown = self._get_element(elem_or_selector) |
| 427 | dropdown.click() |
| 428 | |
| 429 | menu = self._get_element(".dash-dropdown-options") |
| 430 | logger.debug("the available options are %s", "|".join(menu.text.split("\n"))) |
| 431 | |
| 432 | options = menu.find_elements(By.CSS_SELECTOR, ".dash-dropdown-option") |
| 433 | if options: |
| 434 | if isinstance(index, int): |
| 435 | options[index].click() |
| 436 | return |
| 437 | |
| 438 | for option in options: |
| 439 | if option.text == value: |
| 440 | option.click() |
| 441 | return |
| 442 | |
| 443 | logger.error( |
| 444 | "cannot find matching option using value=%s or index=%s", value, index |
| 445 | ) |
| 446 | |
| 447 | def toggle_window(self): |
| 448 | """Switch between the current working window and the new opened one.""" |