Ejemplo n.º 1
0
def login():

    # 打开浏览器
    driver = browser_config['chrome']
    # print(driver)
    # driver = Case_01.driver
    # print(driver)
    driver.maximize_window()
    driver.implicitly_wait(30)
    # 脚本运行时,错误的信息将被打印到这个列表中
    driver.verificationErrors = []
    # #是否继续接受下一下警告
    driver.accept_next_alert = True
    # 传入driver对象
    uihandle = UIHandle(driver)
    # 输入url地址
    uihandle.get(LOGIN_URL)
    driver.find_element_by_link_text(u"登录").click()
    time.sleep(3)

    # 调用登录方法
    config.login_config.login(driver)

    res = driver.page_source
    title = driver.title
    img = get_screenshot(driver)

    a = [res, title, img]
    # uihandle.quit()
    # driver.close()
    # time.sleep(5)

    # driver.quit()
    return a
Ejemplo n.º 2
0
def login(username, password):

    # 打开浏览器
    driver = browser_config['chrome']
    # print(driver)
    # driver.maximize_window()
    print(driver.get_window_size())
    driver.set_window_size(1200, 800)
    print(driver.get_window_size())

    driver.implicitly_wait(30)
    # 脚本运行时,错误的信息将被打印到这个列表中
    driver.verificationErrors = []
    # #是否继续接受下一下警告
    driver.accept_next_alert = True
    # 传入driver对象
    uihandle = UIHandle(driver)
    # 输入url地址
    uihandle.get(LOGIN_URL)
    uihandle.Click("老白首页", "首页登录按钮")
    time.sleep(3)
    uihandle.Clear('老白首页', '用户名')
    uihandle.Input('老白首页', '用户名', username)
    uihandle.Input('老白首页', '密码', password)
    uihandle.Click('老白首页', '登录页面登录按钮')
    time.sleep(3)

    res = driver.page_source
    title = driver.title
    img = get_screenshot(driver)

    a = [res, title, img]

    return a
Ejemplo n.º 3
0
def search(msg):
    # 打开浏览器
    driver = browser_config['chrome']
    # 传入driver对象
    uihandle = UIHandle(driver)
    # 输入URL地址
    uihandle.get(LOGIN_URL)
    # 调用二次封装后的方法,此处可见操作了哪个页面,
    # 哪个元素,msg是要插入的值,插入值得操作在另外一个用例文件中传入
    uihandle.Input('博客园首页', '找找看输入框', msg)
    uihandle.Click('博客园首页', '找找看按钮')
    uihandle.quit()
Ejemplo n.º 4
0
13 def search(msg):
14     # 打开浏览器
15     driver = browser_config['chrome']()
16     # 传入driver对象
17     uihandle = UIHandle(driver)
18     #输入url地址
19     uihandle.get(LOGIN_URL)
20     # 调用二次封装后的方法,此处可见操作了哪个页面,哪个元素,msg是要插入的值,插入值得操作在另外一个用例文件中传入
21     uihandle.Input('博客园首页', '找找看输入框', msg)
22     uihandle.Click('博客园首页', '找找看按钮')
23     uihandle.quit()
复制代码
复制代码
 1 #!/usr/bin/env python
 2 # -*- coding: utf-8 -*-
 3 # @Time    : 2017-05-17 11:19
 4 # log/log.py
 5
 6 import logging
 7 import logging.handlers
 8
 9 # 日志类