• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Accruent / robotframework-zoomba / 7629307322

23 Jan 2024 05:09PM UTC coverage: 100.0%. Remained the same
7629307322

push

github

web-flow
Bump selenium from 4.16.0 to 4.17.2 (#388)

Bumps [selenium](https://github.com/SeleniumHQ/Selenium) from 4.16.0 to 4.17.2.
- [Release notes](https://github.com/SeleniumHQ/Selenium/releases)
- [Commits](https://github.com/SeleniumHQ/Selenium/commits)

---
updated-dependencies:
- dependency-name: selenium
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

621 of 621 relevant lines covered (100.0%)

5.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/Zoomba/Helpers/ReactSelect.py
1
"""
2
This module is for the ReactSelect class, which mimics the Selenium Library Select class, but for React-Select components.
3
See: https://github.com/SeleniumHQ/selenium/blob/trunk/py/selenium/webdriver/support/select.py
4

5
See the Helpers/ReactHelpersREADME.md for more information on the structure of React-Select components
6

7
"""
8

9
from selenium.common.exceptions import UnexpectedTagNameException
5✔
10
from selenium.webdriver.common.by import By
5✔
11

12

13
class ReactSelect:
5✔
14
    """React Select
15

16
    This class is for helper methods for the Zoomba GUI Library, specifically for React-Select components.
17
    React-Select components use <div> tags instead of the traditional <select> & <option>.
18
    Zoomba.GUILibrary method Example:
19
            from ReactSelect import ReactSelect as RS
20
            react_select_container = self.find_element(locator)
21
            options = RS.ReactSelect(react_select_container).options()
22
    """
23

24
    def __init__(self, webelement):
5✔
25
        """
26
        Constructor. A check is made that the given element is, indeed, a DIV tag. If it is not,
27
        then an UnexpectedTagNameException is thrown.
28

29
        :Args:
30
         - webelement - Web element representing the React-Select container <div> element.
31

32
        """
33
        if webelement.tag_name.lower() != "div":
5✔
34
            raise UnexpectedTagNameException(f"ReactSelect only works on <div> elements, not on <{webelement.tag_name}>")
5✔
35
        self._el = webelement
5✔
36

37
    def options(self):
5✔
38
        """Returns a list of all options belonging to the React-Select container"""
39
        self.expand_select_list()
5✔
40
        return self._el.find_elements(By.XPATH, './div[2]/div[1]/div')
5✔
41

42
    def is_expanded(self):
5✔
43
        """Checks if the React-Select container is expanded by checking if the Menu <div>
44
        exists as a child of the container
45
        """
46
        menu_elements = self._el.find_elements(By.XPATH, './div[2]')
5✔
47
        if len(menu_elements) == 0:
5✔
48
            return False
5✔
49
        if len(menu_elements) == 1:
5✔
50
            return True
5✔
51
        raise LookupError("ReactSelect.is_expanded: Multiple selection menus found")
5✔
52

53
    def expand_select_list(self):
5✔
54
        """Expands the Select list only if it's collapsed"""
55
        is_expanded = self.is_expanded()
5✔
56
        if not is_expanded:
5✔
57
            self._el.click()
5✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc