瀏覽代碼

Add timeout to click method (#4500)

version-14
Valmik 7 年之前
committed by Rushabh Mehta
父節點
當前提交
fe9ae224f6
共有 1 個檔案被更改,包括 4 行新增4 行删除
  1. +4
    -4
      frappe/utils/selenium_testdriver.py

+ 4
- 4
frappe/utils/selenium_testdriver.py 查看文件

@@ -166,8 +166,8 @@ class TestDriver(object):


self.wait_for(xpath='//div[@data-page-route="{0}"]'.format('/'.join(args)), timeout=4) self.wait_for(xpath='//div[@data-page-route="{0}"]'.format('/'.join(args)), timeout=4)


def click(self, css_selector, xpath=None):
element = self.wait_till_clickable(css_selector, xpath)
def click(self, css_selector, xpath=None, timeout=20):
element = self.wait_till_clickable(css_selector, xpath, timeout)
self.scroll_to(css_selector) self.scroll_to(css_selector)
time.sleep(0.5) time.sleep(0.5)
element.click() element.click()
@@ -196,7 +196,7 @@ class TestDriver(object):
if elem.is_displayed(): if elem.is_displayed():
return elem return elem


def wait_till_clickable(self, selector=None, xpath=None):
def wait_till_clickable(self, selector=None, xpath=None, timeout=20):
if self.cur_route: if self.cur_route:
selector = self.cur_route + " " + selector selector = self.cur_route + " " + selector


@@ -205,7 +205,7 @@ class TestDriver(object):
by = By.XPATH by = By.XPATH
selector = xpath selector = xpath


return self.get_wait().until(EC.element_to_be_clickable(
return self.get_wait(timeout).until(EC.element_to_be_clickable(
(by, selector))) (by, selector)))






Loading…
取消
儲存