Wait for user menu items to become visible before clicking them

Change-Id: I312e63eafa7a92ce05028de3505f37547a0bc139
Closes-Bug: #1574734
This commit is contained in:
Sergei Chipiga 2016-04-25 13:31:01 +03:00
parent f7bed78008
commit bee35b5f42
2 changed files with 4 additions and 3 deletions

View File

@ -124,9 +124,8 @@ class BaseWebObject(unittest.TestCase):
return self._wait_until(predicate, timeout)
def _wait_till_element_visible(self, element, timeout=None):
self._wait_until(lambda x: self._is_element_displayed(element),
timeout)
def _wait_till_element_visible(self, locator, timeout=None):
self._wait_until(lambda x: self._is_element_visible(*locator), timeout)
def _wait_till_element_disappears(self, element, timeout=None):
self._wait_until(lambda x: not self._is_element_displayed(element),

View File

@ -179,6 +179,7 @@ class NavigationAccordionRegion(baseregion.BaseRegion):
class DropDownMenuRegion(baseregion.BaseRegion):
"""Drop down menu region."""
_menu_container_locator = (by.By.CSS_SELECTOR, 'ul.dropdown-menu')
_menu_items_locator = (by.By.CSS_SELECTOR,
'ul.dropdown-menu > li > *')
_menu_first_child_locator = (by.By.CSS_SELECTOR,
@ -198,6 +199,7 @@ class DropDownMenuRegion(baseregion.BaseRegion):
"""Opens menu by clicking on the first child of the source element."""
if self.is_open() is False:
self._get_element(*self._menu_first_child_locator).click()
self._wait_till_element_visible(self._menu_container_locator)
class UserDropDownMenuRegion(DropDownMenuRegion):