# Path: AXUI/logger/logger.py
# LOGGER = logging.getLogger(logger_config.logger_name)
# 
# Path: AXUI/exceptions.py
# class DriverException(AXUI_BaseException):
#     pass


import re
import inspect
    import selenium.webdriver as webdriver
from AXUI.logger import LOGGER
from AXUI.exceptions import DriverException
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
from . import Translater
    LOGGER.error("To use AXUI selenium driver, you must install selenium python project first, check https://pypi.python.org/pypi/selenium")
    raise e


class Keyboard(object):
    def __init__(self, selenium_element):
        self.selenium_element = selenium_element

    def input(self, *values):
        '''send keyboard input to UI element

        Keyboard input string:
        (1) For normal charactors like [0~9][a~z][A~Z], input directly
        (2) For special charactors like "space", "tab", "newline", "F1~F12"
            You use {key_name} to replace them, all support keys in "selenium/webdriver/common/keys "
        '''
        translated_values = []
        for value in values:
            #still support selenium Keys object
            if isinstance(value, Keys):
                translated_values.append(value)
            elif isinstance(value, int):
                translated_values.append(str(value))
            elif isinstance(value, str):
                #handle special keys
                if re.match("^{.*}$", value) != None:
                    key = value.lstrip("{").rstrip("}")
                    try:
                        key_value = getattr(Keys, key)
                    except AttributeError as e:

# Path: AXUI/logger/logger.py
# LOGGER = logging.getLogger(logger_config.logger_name)
# 
# Path: AXUI/exceptions.py
# class DriverException(AXUI_BaseException):
#     pass


# Path: AXUI/driver/selenium_driver/UIElement.py
import re
import inspect
    import selenium.webdriver as webdriver
from AXUI.logger import LOGGER
from AXUI.exceptions import DriverException
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
from . import Translater

    LOGGER.error("To use AXUI selenium driver, you must install selenium python project first, check https://pypi.python.org/pypi/selenium")
    raise e


class Keyboard(object):
    def __init__(self, selenium_element):
        self.selenium_element = selenium_element

    def input(self, *values):
        '''send keyboard input to UI element

        Keyboard input string:
        (1) For normal charactors like [0~9][a~z][A~Z], input directly
        (2) For special charactors like "space", "tab", "newline", "F1~F12"
            You use {key_name} to replace them, all support keys in "selenium/webdriver/common/keys "
        '''
        translated_values = []
        for value in values:
            #still support selenium Keys object
            if isinstance(value, Keys):
                translated_values.append(value)
            elif isinstance(value, int):
                translated_values.append(str(value))
            elif isinstance(value, str):
                #handle special keys
                if re.match("^{.*}$", value) != None:
                    key = value.lstrip("{").rstrip("}")
                    try:
                        key_value = getattr(Keys, key)
                    except AttributeError as e:

                        LOGGER.warning("Input special key not support: %s, skip this input" , key)