Exemplo n.º 1
0
def click(locate_method, locate_expression):
    global driver
    try:
        element = WaitUtil(driver).visibleOfElement(locate_method,
                                                    locate_expression)
        element.click()
    except:
        print("点击按钮出错")
def input(locate_method, locate_expr, content):
    global driver
    try:
        element = WaitUtil(driver).visableofElement(locate_method, locate_expr)
        element.send_keys(content)
    except:
        logging.info("webelement:%s->%s  operate fail" %
                     (locate_method, locate_expr))
Exemplo n.º 3
0
def input(locate_method, locate_expression, content):
    global driver
    try:
        element = WaitUtil(driver).visibleOfElement(locate_method,
                                                    locate_expression)
        element.send_keys(content)
    except:
        traceback.print_exc()
        print("输入内容出现了异常")
def click(locate_method, locate_expr):
    global driver
    try:
        wait_obj = WaitUtil(driver)
        element = wait_obj.visableofElement(locate_method, locate_expr)
        element.click()
    except:
        logging.info("webelement:%s->%s  operate fail" %
                     (locate_method, locate_expr))
Exemplo n.º 5
0
def click(locate_method, locate_expression):
    global driver
    try:
        element = WaitUtil(driver).visibleOfElement(locate_method,
                                                    locate_expression)
        element.click()
    except:
        print("输入内容出现了异常")
        info("webelement:%s->%s  operate fail" %
             (locate_method, locate_expression))
Exemplo n.º 6
0
def input(locate_method, locate_expression, content):
    global driver
    try:
        element = WaitUtil(driver).visibleOfElement(locate_method,
                                                    locate_expression)
        element.send_keys(content)
    except:
        print("输入内容出现了异常")
        info("webelement:%s->%s  operate fail" %
             (locate_method, locate_expression))
Exemplo n.º 7
0
def open_browser(browserName, *args):
    global driver, waitUtil
    try:
        if browserName.lower() == "ie":
            driver = webdriver.Ie(executable_path=ieDriverFilePath)
        elif browserName.lower() == "chrome":
            #创建chrome浏览器的一个Options实例对象
            chrome_options = Options()
            #添加屏蔽-ignore-certificate-errors提示信息的设置参数项
            chrome_options.add_experimental_option(
                "excludeSwitches", ["ignore-certificate-errors"])
            driver = webdriver.Chrome(executable_path=chromeDriverFilePath,
                                      chrome_options=chrome_options)
        else:
            driver = webdriver.Firefox(executable_path=firefoxDriverFilePath)
    #driver 对象创建成功后,创建等待类实例对象
        waitUtil = WaitUtil(driver)
    except Exception, e:
        raise e