Similar to find_element().
(self, selector, timeout=None)
| 407 | return updated_elements |
| 408 | |
| 409 | def select(self, selector, timeout=None): |
| 410 | """Similar to find_element().""" |
| 411 | if not timeout: |
| 412 | timeout = settings.SMALL_TIMEOUT |
| 413 | self.__add_light_pause() |
| 414 | selector = self.__convert_to_css_if_xpath(selector) |
| 415 | if (":contains(" in selector): |
| 416 | return self.find_element(selector, timeout=timeout) |
| 417 | failure = False |
| 418 | message = "" |
| 419 | try: |
| 420 | element = self.loop.run_until_complete( |
| 421 | self.page.select(selector, timeout=timeout) |
| 422 | ) |
| 423 | except Exception: |
| 424 | failure = True |
| 425 | plural = "s" |
| 426 | if timeout == 1: |
| 427 | plural = "" |
| 428 | msg = "\n Element {%s} was not found after %s second%s!" |
| 429 | message = msg % (selector, timeout, plural) |
| 430 | if failure: |
| 431 | raise Exception(message) |
| 432 | element = self.__add_sync_methods(element) |
| 433 | self.__slow_mode_pause_if_set() |
| 434 | return element |
| 435 | |
| 436 | def select_all(self, selector, timeout=None): |
| 437 | if not timeout: |