'Given the identifier to a page element, make it active.
Currently done by clicking TODO(bcipolli): this won\'t work for buttons,
so find another way when that becomes an issue.'

def browser_activate_element(self, **kwargs):

    browser = kwargs.get('browser', self.browser)
    elem = kwargs.get('elem')
    _id = kwargs.get('id')
    name = kwargs.get('name')
    tag_name = kwargs.get('tag_name')
    css_class = kwargs.get('css_class')
    xpath = kwargs.get('xpath')
    max_wait = kwargs.get('max_wait', FIND_ELEMENT_TIMEOUT)
    try:
        if (not elem):
            if _id:
                locator = (By.ID, _id)
            elif name:
                locator = (By.NAME, name)
            elif tag_name:
                locator = (By.TAG_NAME, tag_name)
            elif css_class:
                locator = (By.CLASS_NAME, css_class)
            elif xpath:
                locator = (By.XPATH, xpath)
        elem = WebDriverWait(browser, max_wait).until(EC.presence_of_element_located(locator))
    except TimeoutException:
        raise KALiteTimeout('browser_activate_element    timed    out    with    keyword    arguments:    {0}'.format(kwargs))
    else:
        WebDriverWait(browser, max_wait).until(EC.element_to_be_clickable(locator))
        elem.click()
