def wait(self, condition, interval, *args):
        """
        :Description: Create an interval in vm.window, will clear interval after condition met.
        :param condition: Condition in javascript to pass to interval.
        :example: '$el.innerText == "cheesecake"'
        :example: '$el[0].disabled && $el[1].disabled'
        :type condition: string
        :param interval: Time in milliseconds to execute interval.
        :type interval: int or float
        :param *args: WebElement or selector of condition element.
        :type *args: tuple
        :return: string
        """
        hid = lambda: '$' + str(uuid.uuid1())[:8]
        handle = hid()
        if len(args):
            element_handle = hid()
            self.browser.execute_script(
                'window["{}"] = [];'.format(element_handle)
            )  # create element container in window scope
            for el in args:
                if isinstance(el, string_types):
                    # assume selector
                    self.browser.execute_script('window["{}"].push({});'.format(
                        element_handle, 'function() { return document.querySelector("%s") }' % el))
                else:
                    # assume web element
                    self.browser.execute_script(
                        'window["{}"].push(arguments[0]);'.format(element_handle), el)
            if len(args) == 1:
                condition = condition.replace('$el', 'window["{}"][0]{}'.format(
                    element_handle, '()' if isinstance(args[0], string_types) else ''))
            else:
                regex = r'(\$el\[([0-9]{0,3})\])'
                results = re.findall(regex, condition)  # [('$el[0]', '0'), ('$el[1]', '1'), ...]
                for result in results:
                    pos = eval(result[1])
                    if pos + 1 <= len(args):
                        condition = condition.replace(result[0], 'window["{}"][{}]{}'.format(
                            element_handle, pos, '()' if isinstance(args[pos], string_types) else ''))

            self.browser.execute_script(
                'window["%s"]=window.setInterval(function(){if(%s){ \
                (window.clearInterval(window["%s"])||true)&&(window["%s"]=-1); \
                delete window["%s"];}}, %s)' % (handle, condition, handle, handle, \
                element_handle, interval))  # create interval
        else:
            self.browser.execute_script(
                'window["%s"]=window.setInterval(function(){if(%s){ \
                (window.clearInterval(window["%s"])||true)&&(window["%s"]=-1);}}, %s)' % (
                handle, condition, handle, handle, interval))  # create interval

        return handle
def wait ( self , condition , interval , * args ) : hid = lambda : '$' + str ( uuid . uuid1 ( ) ) [ : 8 ] handle = hid ( ) if len ( args ) : element_handle = hid ( ) self . browser . execute_script ( 'window["{}"] = [];' . format ( element_handle ) ) for el in args : if isinstance ( el , string_types ) : self . browser . execute_script ( 'window["{}"].push({});' . format ( element_handle , 'function() { return document.querySelector("%s") }' % el ) ) else : self . browser . execute_script ( 'window["{}"].push(arguments[0]);' . format ( element_handle ) , el ) if len ( args ) == 1 : condition = condition . replace ( '$el' , 'window["{}"][0]{}' . format ( element_handle , '()' if isinstance ( args [ 0 ] , string_types ) else '' ) ) else : regex = r'(\$el\[([0-9]{0,3})\])' results = re . findall ( regex , condition ) for result in results : pos = eval ( result [ 1 ] ) if pos + 1 <= len ( args ) : condition = condition . replace ( result [ 0 ] , 'window["{}"][{}]{}' . format ( element_handle , pos , '()' if isinstance ( args [ pos ] , string_types ) else '' ) ) self . browser . execute_script ( 'window["%s"]=window.setInterval(function(){if(%s){ \
                (window.clearInterval(window["%s"])||true)&&(window["%s"]=-1); \
                delete window["%s"];}}, %s)' % ( handle , condition , handle , handle , element_handle , interval ) ) else : self . browser . execute_script ( 'window["%s"]=window.setInterval(function(){if(%s){ \
                (window.clearInterval(window["%s"])||true)&&(window["%s"]=-1);}}, %s)' % ( handle , condition , handle , handle , interval ) ) return handle
:Description: Create an interval in vm.window, will clear interval after condition met.
        :param condition: Condition in javascript to pass to interval.
        :example: '$el.innerText == "cheesecake"'
        :example: '$el[0].disabled && $el[1].disabled'
        :type condition: string
        :param interval: Time in milliseconds to execute interval.
        :type interval: int or float
        :param *args: WebElement or selector of condition element.
        :type *args: tuple
        :return: string