def expand_subsection(self): """ Toggle the expansion of this subsection. """ disable_animations(self) def subsection_expanded(): """ Returns whether or not this subsection is expanded. """ self.wait_for_element_presence( self._bounded_selector(self.ADD_BUTTON_SELECTOR), 'Toggle control is present' ) add_button = self.q(css=self._bounded_selector(self.ADD_BUTTON_SELECTOR)).first.results return add_button and add_button[0].is_displayed() currently_expanded = subsection_expanded() # Need to click slightly off-center in order for the click to be recognized. ele = self.browser.find_element_by_css_selector(self._bounded_selector('.ui-toggle-expansion .fa')) ActionChains(self.browser).move_to_element_with_offset(ele, 8, 8).click().perform() # pylint: disable=no-member self.wait_for_element_presence(self._bounded_selector(self.ADD_BUTTON_SELECTOR), 'Subsection is expanded') EmptyPromise( lambda: subsection_expanded() != currently_expanded, "Check that the container {} has been toggled".format(self.locator) ).fulfill() enable_animations(self) return self