# Path: wtframework/wtf/_devtools_/filetemplates/_page_object_template_.py



from datetime import datetime
from six import u
from wtframework.wtf._devtools_.filetemplates import _page_object_template_
import re
import urllib2




def _process_input_tag(html):
    html = html.lower()

    # find name property expression, used is varous input types.
    name_expr = u"name=['\"]([^'\"]+)['\"]"
    value_expr = u"value=['\"]([^'\"]+)['\"]"

    # process text input
    if (u("type=\"text\"") in html) or (not u("type") in html):
        try:
            name = re.search(name_expr, html, re.IGNORECASE).group(1)
            display_name = _strip_non_chars_from_name(name)
            obj = u("{name}_text = lambda self: self.webdriver.find_element_by_name(\"{name}\")")\
                .format(name=name, display_name=display_name)
            return obj
        except:
            pass

    # process password input
    if u("type=\"password\"") in html:
        try:
            name = re.search(name_expr, html, re.IGNORECASE).group(1)
            display_name = _strip_non_chars_from_name(name)
            if display_name != u("password"):
                display_name += u("_password")
            obj = u("{display_name} = lambda self: self.webdriver.find_element_by_name(\"{name}\")")\

# Path: wtframework/wtf/_devtools_/filetemplates/_page_object_template_.py



# Path: wtframework/wtf/_devtools_/page_object_tools.py
from datetime import datetime
from six import u
from wtframework.wtf._devtools_.filetemplates import _page_object_template_
import re
import urllib2





def _process_input_tag(html):
    html = html.lower()

    # find name property expression, used is varous input types.
    name_expr = u"name=['\"]([^'\"]+)['\"]"
    value_expr = u"value=['\"]([^'\"]+)['\"]"

    # process text input
    if (u("type=\"text\"") in html) or (not u("type") in html):
        try:
            name = re.search(name_expr, html, re.IGNORECASE).group(1)
            display_name = _strip_non_chars_from_name(name)
            obj = u("{name}_text = lambda self: self.webdriver.find_element_by_name(\"{name}\")")\
                .format(name=name, display_name=display_name)
            return obj
        except:
            pass

    # process password input
    if u("type=\"password\"") in html:
        try:
            name = re.search(name_expr, html, re.IGNORECASE).group(1)
            display_name = _strip_non_chars_from_name(name)
            if display_name != u("password"):
                display_name += u("_password")
            obj = u("{display_name} = lambda self: self.webdriver.find_element_by_name(\"{name}\")")\

                .format(name=name, display_name=display_name)