# Path: webdriverwrapper/exceptions.py
# def _create_exception_msg(
#         id_=None, class_name=None, name=None, tag_name=None,
#         parent_id=None, parent_class_name=None, parent_name=None, parent_tag_name=None,
#         text=None, xpath=None, css_selector=None, url=None,
#         driver=None,
# ):
# def _create_exception_msg_tag(
#         id_=None, class_name=None, name=None, tag_name=None,
#         parent_id=None, parent_class_name=None, parent_name=None, parent_tag_name=None,
#         text=None, xpath=None, css_selector=None,
# ):
# def _create_exception_msg_tag_element(id_=None, class_name=None, name=None, tag_name=None, text=None, xpath=None, css_selector=None):
# def _get_suggestion(driver, id_=None, class_name=None, name=None):
# def _find_best_suggestion(value, items):
#     def __init__(self, url, msg):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self, url, error_page, expected_error_page, allowed_error_pages, traceback=None):
#     def __init__(self, url, error_messages, expected_error_messages, allowed_error_messages):
#     def __init__(self, url, js_errors):
#     def __init__(self, url, info_messages, expected_info_messages, allowed_info_messages):
# class WebdriverWrapperException(Exception):
# class ErrorPageException(WebdriverWrapperException):
# class ErrorMessagesException(WebdriverWrapperException):
# class JSErrorsException(WebdriverWrapperException):
# class InfoMessagesException(WebdriverWrapperException):
# 
# Path: webdriverwrapper/wrapper.py
# class _WebElementWrapper(_WebdriverBaseWrapper, WebElement):
#     """
#     Class wrapping :py:class:`selenium.WebElement <selenium.webdriver.remote.webelement.WebElement>`.
#     """
# 
#     def __new__(cls, webelement):
#         instance = super().__new__(cls)
#         instance.__dict__.update(webelement.__dict__)
#         return instance
# 
#     def __init__(self, webelement):
#         # Nothing to do because whole __dict__ of original WebElement was
#         # copied during creation of instance.
#         pass
# 
#     @property
#     def _driver(self):
#         """
#         Returns always driver, not element. Use it when you need driver
#         and variable can be driver or element.
#         """
#         return self._parent
# 
#     @property
#     def current_url(self):
#         """
#         Accessing :py:attr:`~selenium.webdriver.remote.webdriver.WebDriver.current_url`
#         also on elements.
#         """
#         try:
#             current_url = self._driver.current_url
#         except Exception:  # pylint: disable=broad-except
#             current_url = 'unknown'
#         finally:
#             return current_url
# 
#     @property
#     def html(self):
#         """
#         Returns ``innerHTML``.
# 
#         .. versionadded:: 2.2
#         """
#         self.get_attribute('innerHTML')
# 
#     def clear(self):
#         # Just add some context when calling clear fails.
#         try:
#             return super().clear()
#         except (
#                 selenium_exc.StaleElementReferenceException,
#                 selenium_exc.InvalidElementStateException,
#                 selenium_exc.ElementNotVisibleException,
#                 selenium_exc.ElementNotSelectableException,
#         ) as exc:
#             raise exc.__class__('Problem clearing element at {}.'.format(self.current_url))
# 
#     def download_file(self):
#         """
#         With WebDriver you can't check status code or headers. For this you have
#         to make classic request. But web pages needs cookies and data from forms
#         and by this it gets pretty ugly. You can easily use this method.
# 
#         It can handle downloading of page/file by link or any type of form.
# 
#         Returns :py:obj:`~webdriverwrapper.download._Download` instance.
#         """
#         return DownloadFile(self)


import pytest
from webdriverwrapper.exceptions import NoSuchElementException, TimeoutException
from webdriverwrapper.wrapper import _WebElementWrapper
    text = 'ěščřž'
    if hasattr(text, 'decode'):
        text = text.decode('utf8')

    assert driver.get_elms(text=text)


def test_find_elements_selenium_not_search(driver):
    elms = driver.get_elms(text='text')
    assert len(elms) == 2


def test_contains_text(driver):
    assert driver.contains_text('text')


def test_find_element_by_text(driver):
    assert driver.get_elm(text='text')


def test_find_element_by_text_fail(driver):
    with pytest.raises(NoSuchElementException) as excinfo:
        driver.get_elm(text='notextatpage')


def test_wait_for_element(driver):
    assert driver.wait_for_element(timeout=0.5, id_='somepage')


def test_wait_for_element_on_element(driver):

# Path: webdriverwrapper/exceptions.py
# def _create_exception_msg(
#         id_=None, class_name=None, name=None, tag_name=None,
#         parent_id=None, parent_class_name=None, parent_name=None, parent_tag_name=None,
#         text=None, xpath=None, css_selector=None, url=None,
#         driver=None,
# ):
# def _create_exception_msg_tag(
#         id_=None, class_name=None, name=None, tag_name=None,
#         parent_id=None, parent_class_name=None, parent_name=None, parent_tag_name=None,
#         text=None, xpath=None, css_selector=None,
# ):
# def _create_exception_msg_tag_element(id_=None, class_name=None, name=None, tag_name=None, text=None, xpath=None, css_selector=None):
# def _get_suggestion(driver, id_=None, class_name=None, name=None):
# def _find_best_suggestion(value, items):
#     def __init__(self, url, msg):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self, url, error_page, expected_error_page, allowed_error_pages, traceback=None):
#     def __init__(self, url, error_messages, expected_error_messages, allowed_error_messages):
#     def __init__(self, url, js_errors):
#     def __init__(self, url, info_messages, expected_info_messages, allowed_info_messages):
# class WebdriverWrapperException(Exception):
# class ErrorPageException(WebdriverWrapperException):
# class ErrorMessagesException(WebdriverWrapperException):
# class JSErrorsException(WebdriverWrapperException):
# class InfoMessagesException(WebdriverWrapperException):
# 
# Path: webdriverwrapper/wrapper.py
# class _WebElementWrapper(_WebdriverBaseWrapper, WebElement):
#     """
#     Class wrapping :py:class:`selenium.WebElement <selenium.webdriver.remote.webelement.WebElement>`.
#     """
# 
#     def __new__(cls, webelement):
#         instance = super().__new__(cls)
#         instance.__dict__.update(webelement.__dict__)
#         return instance
# 
#     def __init__(self, webelement):
#         # Nothing to do because whole __dict__ of original WebElement was
#         # copied during creation of instance.
#         pass
# 
#     @property
#     def _driver(self):
#         """
#         Returns always driver, not element. Use it when you need driver
#         and variable can be driver or element.
#         """
#         return self._parent
# 
#     @property
#     def current_url(self):
#         """
#         Accessing :py:attr:`~selenium.webdriver.remote.webdriver.WebDriver.current_url`
#         also on elements.
#         """
#         try:
#             current_url = self._driver.current_url
#         except Exception:  # pylint: disable=broad-except
#             current_url = 'unknown'
#         finally:
#             return current_url
# 
#     @property
#     def html(self):
#         """
#         Returns ``innerHTML``.
# 
#         .. versionadded:: 2.2
#         """
#         self.get_attribute('innerHTML')
# 
#     def clear(self):
#         # Just add some context when calling clear fails.
#         try:
#             return super().clear()
#         except (
#                 selenium_exc.StaleElementReferenceException,
#                 selenium_exc.InvalidElementStateException,
#                 selenium_exc.ElementNotVisibleException,
#                 selenium_exc.ElementNotSelectableException,
#         ) as exc:
#             raise exc.__class__('Problem clearing element at {}.'.format(self.current_url))
# 
#     def download_file(self):
#         """
#         With WebDriver you can't check status code or headers. For this you have
#         to make classic request. But web pages needs cookies and data from forms
#         and by this it gets pretty ugly. You can easily use this method.
# 
#         It can handle downloading of page/file by link or any type of form.
# 
#         Returns :py:obj:`~webdriverwrapper.download._Download` instance.
#         """
#         return DownloadFile(self)


# Path: tests/test_wrapper.py
import pytest
from webdriverwrapper.exceptions import NoSuchElementException, TimeoutException
from webdriverwrapper.wrapper import _WebElementWrapper

    text = 'ěščřž'
    if hasattr(text, 'decode'):
        text = text.decode('utf8')

    assert driver.get_elms(text=text)


def test_find_elements_selenium_not_search(driver):
    elms = driver.get_elms(text='text')
    assert len(elms) == 2


def test_contains_text(driver):
    assert driver.contains_text('text')


def test_find_element_by_text(driver):
    assert driver.get_elm(text='text')


def test_find_element_by_text_fail(driver):
    with pytest.raises(NoSuchElementException) as excinfo:
        driver.get_elm(text='notextatpage')


def test_wait_for_element(driver):
    assert driver.wait_for_element(timeout=0.5, id_='somepage')


def test_wait_for_element_on_element(driver):

    with pytest.raises(TimeoutException):