• 请教高手,在 screenshot()里增加了下面的代码,但 html report 里的截图显示不出来,返回的 base64 字符串好像不太对。

    #----新增代码开始------
    elif format == 'base64':
    import base64
    # b64encode 是编码,b64decode 是解码
    base64_data = base64.b64encode(r.content)
    # base64.b64decode(base64data)
    return base64_data
    #----新增代码结束------

    这个是返回的 base64,是 b'开头呢?
    data:image/jpg;base64,b'/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAeABDgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK