zoukankan      html  css  js  c++  java
  • get value,screenshot soal

    # coding:utf-8

    class getvales():

    def getdict(dict1, values):
    global values1,va #定义全局变量
    values1 = values
    for k, v in dict1.items(): #把字典的key和values变成数组
    if k == values:
    va = v

    elif list is type(v): #判断类型是不是list
    getvales.getlsit(v)

    elif type(v) is dict:
    getvales.getdict(v, values1)

    else:
    print(str(k) + ":" + str(v))

    return va

    def getlsit(list1):
    for i in list1:
    if list is type(i):
    getvales.getlsit(i)

    elif dict is type(i):
    getvales.getdict(i, values1)
    else:
    print(list1)


    if __name__ == "__main__":
    key = getvales()
    # res = {
    # "code": "200",
    # "msg": "success",
    # "data": {
    # "useState": 0
    # },
    # "success": "true"
    # }
    # value = getvales.getdict(res, "data")
    # print(value)
    =================================================
    # coding:utf-8
    import time, os


    def getImage(self):
    '''
    截取图片,并保存在images文件夹
    '''
    curpath = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
    images_path = os.path.join(curpath, "case")
    timestrmap = time.strftime('%Y%m%d_%H.%M.%S')
    imgPath = os.path.join(images_path, '%s.png' % str(timestrmap))

    self.driver.save_screenshot(imgPath)
    print('screenshot:', timestrmap, '.png')
    return getImage()
  • 相关阅读:
    多项式回归学习笔记
    线性回归学习笔记
    CentOS6.9下安装python notebook
    CentOS 6.9下安装PostgreSQL
    区块链共识机制及其迭代
    比特币的区块结构解析
    区块链学习路线
    应用缓存的常见问题及解决
    阿里巴巴开源技术体系
    工程师进阶推荐十本书
  • 原文地址:https://www.cnblogs.com/yaohu/p/12597285.html
Copyright © 2011-2022 走看看