Fix BaseRegion and TabbedFormRegion initialization

Now `src_elem` and `_default_src_locator` properties work in
conjunction - if both are specified, `_default_src_locator` is being
searched in the provided `src_elem`. This fixes the issue of binding
table tabs instead of form tabs on the same page.

Co-Authored-By: Georgy Dyuldin <gdyuldin@mirantis.com>
Change-Id: Id91d82062d4145f37c7b1a33fca56bf7e441aa6e
Closes-Bug: #1549632
This commit is contained in:
Timur Sufiev 2016-03-01 17:32:36 +03:00
parent bf66705b1e
commit 592da26870
2 changed files with 5 additions and 6 deletions

View File

@ -30,11 +30,9 @@ class BaseRegion(basewebobject.BaseWebObject):
# private methods
def __init__(self, driver, conf, src_elem=None):
super(BaseRegion, self).__init__(driver, conf)
if src_elem is None and self._default_src_locator:
# fake self.src_elem must be set up in
# order self._get_element work
self.src_elem = driver
src_elem = self._get_element(*self._default_src_locator)
if self._default_src_locator:
root = src_elem or driver
src_elem = root.find_element(*self._default_src_locator)
self.src_elem = src_elem or driver

View File

@ -388,7 +388,8 @@ class TabbedFormRegion(FormRegion):
@property
def tabs(self):
return menus.TabbedMenuRegion(self.driver, self.conf)
return menus.TabbedMenuRegion(self.driver, self.conf,
src_elem=self.src_elem)
class DateFormRegion(BaseFormRegion):