当前位置:网站首页>RIDE:获取图片base64
RIDE:获取图片base64
2022-06-30 22:11:00 【CY呵】
python脚本中:
import base64
filepath=r'D:\图片集\0\7102528551.jpg'
f=open(filepath, 'rb')
print(f)
ls_f = base64.b64encode(f.read()).decode("utf8") # 读取文件内容,转换为base64编码
print(ls_f)
f.close()
按照python脚本步骤,在RIDE中编写用例步骤:

base64.b64encode(open('${filepath}','rb').read()).decode('utf8')

在External Resources中新增keyword,方便在测试用例中调用


*** Settings ***
Library Selenium2Library
Library Collections
*** Keywords ***
图片转换base64
[Arguments] ${filepath}
${pic_base64} Evaluate base64.b64encode(open('${filepath}','rb').read()).decode('utf8') base64
#log ${pic_base64}
Evaluate open('${filepath}','rb').close()
[Return] ${pic_base64} 
边栏推荐
- Windbg调试工具介绍
- Introduction and example of template method mode
- How does win11 optimize services? Win11 method of optimizing service
- Summary of interesting websites
- 从PG15 XID64再次跳票说起
- HDFS集中式缓存管理(Centralized Cache Management)
- How to use filters in jfinal to monitor Druid for SQL execution?
- Meet the StreamNative | 杨子棵:是什么让我放弃了大厂 Offer
- 多线程经典案例
- 去中心化交易所系统开发技术原理丨数字货币去中心化交易所系统开发(说明案例)
猜你喜欢

2022-06-30:以下golang代码输出什么?A:0;B:2;C:运行错误。 package main import “fmt“ func main() { ints := make

The Sandbox 正在 Polygon 网络上进行部署

The programmer's girlfriend gave me a fatigue driving test

Alibaba Kube eventer MySQL sink simple usage record

【MySQL入门】第一话 · 初入“数据库”大陆

Uniapp routing uni simple router

On several key issues of digital transformation

Installing jupyter notebook under Anaconda

Introduction and example of template method mode

WinDbg debugging tool introduction
随机推荐
Which direction should college students choose to find jobs after graduation?
Interesting plug-ins summary
AtCoder Beginner Contest 257
Alibaba Kube eventer MySQL sink simple usage record
分享十万级TPS的IM即时通讯综合消息系统的架构
从PG15 XID64再次跳票说起
Niubi | the tools I have treasured for many years have made me free to fish with pay
软件测试报告包含哪些内容?如何获取高质量软件测试报告?
Nansen double disk encryption giant self rescue: how to prevent the collapse of billions of dominoes
What if the taskbar is blank after win11 update? Solution to blank and stuck taskbar after win11 update
Technical principle of decentralized exchange system development - digital currency decentralized exchange system development (illustrative case)
[backtracking] full arrangement II leetcode47
【BSP视频教程】BSP视频教程第19期:单片机BootLoader的AES加密实战,含上位机和下位机代码全开源(2022-06-26)
电脑设备管理器在哪里可以找到
Mysql:sql overview and database system introduction | dark horse programmer
Go language learning notes - Gorm usage - database configuration, table addition | web framework gin (VII)
Using Obsidian with Hugo, markdown's local editing software is seamlessly connected with online
How to use data sets in machine learning?
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
Gartner focuses on low code development in China how UNIPRO practices "differentiation"