def click(self, locator, timeout=0, index=0): """ click on an element :type locator: tuple(str, str | list[WebElement] | WebElement) :type timeout: int :type index: int :rtype: WebElement """ if timeout == 0: element = self.find(locator) element.click() else: element = WebDriverWait(self, timeout).until( EC.element_to_be_clickable(locator, index)) element._execute(Command.CLICK_ELEMENT) return element