# Path: src/main/python/taf/foundation/api/ui/web/browser.py
# class Browser(AUT):
#     def __init__(
#             self,
#             name='firefox',
#             identifier=None,
#             **kwargs
#     ):
#         super(Browser, self).__init__(
#             name, identifier, **kwargs
#         )
# 
#     @staticmethod
#     def launch(url='about:blank', **kwargs):
#         raise NotImplementedError(
#             'Web browser navigates to specific page'
#         )
# 
#     def maximize(self):
#         raise NotImplementedError(
#             'Maximize the current browser'
#         )
# 
#     def sync(self, timeout=30):
#         raise NotImplementedError(
#             'Synchronization until browser is fully loaded or timeout'
#         )
# 
#     def _create_instance(self, name, **kwargs):
#         raise NotImplementedError(
#             'Create web browser instance (type={})'.format(
#                 name
#             )
#         )
# 
# Path: src/main/python/taf/foundation/api/ui/web/page.py
# class Page(UIElement):
#     def __init__(self, *elements, **conditions):
#         super(Page, self).__init__(
#             *elements, **conditions
#         )
# 
#     @property
#     def current(self):
#         if self.parent and self.root:
#             self._current = self
# 
#         return self._current
# 
#     def _resolve_parent(self, element=None):
#         if element is None:
#             if Browser.current:
#                 self._parent = Browser.current
#             else:
#                 raise RuntimeError('Browser is required')
#         else:
#             if isinstance(element, Browser):
#                 self._parent = element
#             else:
#                 raise TypeError(
#                     'Invalid argument - parent'
#                 )
# 
#     def _resolve_root(self):
#         if Browser.cache:
#             self._root = Browser.cache.current
#         else:
#             raise RuntimeError(
#                 'UIAutomation Driver is required'
#             )


from taf.foundation.api.ui import UIElement
from taf.foundation.api.ui.support import ElementFinder
from taf.foundation.api.ui.support import Locator
from .browser import Browser
from .page import Page
                self._constraints[key] = value
            else:
                self._locators[key] = value

    def _find_current_element(self):
        prioritized_locators = [
            (key, self._locators.get(key))
            for key in self.locator_enum.prioritized_locators()
            if key in self._locators
        ]

        return self.element_finder(
            anchor=self._resolve_anchor()
        ).find_element(
            *prioritized_locators,
            **self._constraints
        )

    def _resolve_anchor(self):
        if isinstance(self.parent, WebElement):
            anchor = self.parent.object
        elif isinstance(self.parent, Page):
            anchor = self.parent.root
        else:
            anchor = self.root.cache.current

        return anchor

    def _resolve_parent(self, element=None):
        if element is None:

# Path: src/main/python/taf/foundation/api/ui/web/browser.py
# class Browser(AUT):
#     def __init__(
#             self,
#             name='firefox',
#             identifier=None,
#             **kwargs
#     ):
#         super(Browser, self).__init__(
#             name, identifier, **kwargs
#         )
# 
#     @staticmethod
#     def launch(url='about:blank', **kwargs):
#         raise NotImplementedError(
#             'Web browser navigates to specific page'
#         )
# 
#     def maximize(self):
#         raise NotImplementedError(
#             'Maximize the current browser'
#         )
# 
#     def sync(self, timeout=30):
#         raise NotImplementedError(
#             'Synchronization until browser is fully loaded or timeout'
#         )
# 
#     def _create_instance(self, name, **kwargs):
#         raise NotImplementedError(
#             'Create web browser instance (type={})'.format(
#                 name
#             )
#         )
# 
# Path: src/main/python/taf/foundation/api/ui/web/page.py
# class Page(UIElement):
#     def __init__(self, *elements, **conditions):
#         super(Page, self).__init__(
#             *elements, **conditions
#         )
# 
#     @property
#     def current(self):
#         if self.parent and self.root:
#             self._current = self
# 
#         return self._current
# 
#     def _resolve_parent(self, element=None):
#         if element is None:
#             if Browser.current:
#                 self._parent = Browser.current
#             else:
#                 raise RuntimeError('Browser is required')
#         else:
#             if isinstance(element, Browser):
#                 self._parent = element
#             else:
#                 raise TypeError(
#                     'Invalid argument - parent'
#                 )
# 
#     def _resolve_root(self):
#         if Browser.cache:
#             self._root = Browser.cache.current
#         else:
#             raise RuntimeError(
#                 'UIAutomation Driver is required'
#             )


# Path: src/main/python/taf/foundation/api/ui/web/webelement.py
from taf.foundation.api.ui import UIElement
from taf.foundation.api.ui.support import ElementFinder
from taf.foundation.api.ui.support import Locator
from .browser import Browser
from .page import Page

                self._constraints[key] = value
            else:
                self._locators[key] = value

    def _find_current_element(self):
        prioritized_locators = [
            (key, self._locators.get(key))
            for key in self.locator_enum.prioritized_locators()
            if key in self._locators
        ]

        return self.element_finder(
            anchor=self._resolve_anchor()
        ).find_element(
            *prioritized_locators,
            **self._constraints
        )

    def _resolve_anchor(self):
        if isinstance(self.parent, WebElement):
            anchor = self.parent.object
        elif isinstance(self.parent, Page):
            anchor = self.parent.root
        else:
            anchor = self.root.cache.current

        return anchor

    def _resolve_parent(self, element=None):
        if element is None:

            self._parent = Page(self)