def order(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def message(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def homepage(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def superMember(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def services(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def cart(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def todayHotSelling(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://localhost:4723/wd/hub', config()) # 传入driver对象 ui_handle = UIHandle(driver) # driver.implicitly_wait(30) ui_handle.Click('首页-今日热卖', '滚动栏') ui_handle.Click('首页-今日热卖', '滚动栏返回') ui_handle.Click('首页-今日热卖', '签到领钱') ui_handle.Click('首页-今日热卖', '签到页面返回') ui_handle.Click('首页-今日热卖', '热卖榜单') ui_handle.Click('首页-今日热卖', '热卖榜单返回') ui_handle.Click('首页-今日热卖', '升级会员') ui_handle.Click('首页-今日热卖', '升级会员返回') ui_handle.Click('首页-今日热卖', '新人专享') ui_handle.Click('首页-今日热卖', '新人专享返回') ui_handle.Click('首页-今日热卖', '增值服务') ui_handle.Click('首页-今日热卖', '增值服务页面返回') ui_handle.Swipe(500, 1500, 500, 400) ui_handle.Click('首页-今日热卖', '正在疯抢') ui_handle.Click('首页-今日热卖', '商品详情页返回') # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def search(msg): # 打开浏览器 driver = browser_config['chrome'] # 传入driver对象 uihandle = UIHandle(driver) # 输入URL地址 uihandle.get(LOGIN_URL) # 调用二次封装后的方法,此处可见操作了哪个页面, # 哪个元素,msg是要插入的值,插入值得操作在另外一个用例文件中传入 uihandle.Input('博客园首页', '找找看输入框', msg) uihandle.Click('博客园首页', '找找看按钮') uihandle.quit()
def honeycomb(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def hfcz(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="家庭圈"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def search(name): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
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 # 日志类
def login(mobile, code): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text='首页' and contains(@resource-id,'tab')]").text # driver.find_element_by_xpath("//*[@text='体重管理']").click() # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def footPrint(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def mine(): # 调用desired_caps的app配置项 driver = webdriver.Remote('http://*****:*****@text="新增服务号"]').text # 定义截图方法 img = get_screenshot(driver) ui_handle.quit() # 定义数组a,包含name和img a = [img] return a
def login(words): # # 打开浏览器 driver = browser_config['chrome'] # 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) # 调用二次封装后的方法,此处可见操作了哪个页面,哪个元素,后面是要插入的值,插入值得操作在另外一个用例文件中传入 handles = driver.window_handles driver.switch_to.window(handles[0]) js = "window.scrollTo(0,800)" driver.execute_script(js) uihandle.Click('老白首页', '个人中心') handles = driver.window_handles # print(handles) driver.switch_to_window(handles[1]) driver.close() driver.switch_to_window(handles[0]) time.sleep(3) uihandle.Click('老白首页', '家庭医生') time.sleep(3) uihandle.Click('老白首页', '关闭家庭医生') time.sleep(3) uihandle.Click('老白首页', '老白快报') time.sleep(3) handles = driver.window_handles print(handles) driver.switch_to_window(handles[1]) driver.close() driver.switch_to_window(handles[0]) uihandle.Click('老白首页', '常用药') time.sleep(3) handles = driver.window_handles driver.switch_to_window(handles[1]) driver.close() driver.switch_to_window(handles[0]) uihandle.Click('老白首页', '极速达') time.sleep(3) handles = driver.window_handles driver.switch_to_window(handles[1]) driver.close() driver.switch_to_window(handles[0]) uihandle.Click('老白首页', '隐形眼镜1') time.sleep(3) handles = driver.window_handles driver.switch_to_window(handles[1]) driver.close() driver.switch_to_window(handles[0]) # time.sleep(3) uihandle.Click('老白首页', '用户中心') time.sleep(3) handles = driver.window_handles driver.switch_to_window(handles[1]) driver.close() driver.switch_to_window(handles[0]) uihandle.Click('老白首页', '我的购物车') time.sleep(3) handles = driver.window_handles driver.switch_to_window(handles[1]) driver.close() driver.switch_to_window(handles[0]) time.sleep(3) uihandle.Click('老白首页', '在线客服') time.sleep(3) uihandle.Input('老白首页', '输入字符', words) time.sleep(3) uihandle.Click('老白首页', '发送字符') time.sleep(3) uihandle.Click('老白首页', '关闭在线客服') time.sleep(3) # print(driver.page_source) res = driver.page_source title = driver.title img = get_screenshot(driver) a = [res, title, img] uihandle.quit() # for i in range(8): # driver.close() return a