RobotFramework相关

发布时间 2024-01-03 16:08:54作者: 测试小白成长录

1. 错误解决:ImportError: No module named leveldb解决办法
python -m pip install xxx

2. pip命令提示unknow or unsupported command install
解决方法: where pip:查找库在哪个地方做相应处理

3. WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones.

解决方案:把IE的所有区域的保护模式都设置为Disable

4.数据库返回乱码解决(处理完之后RIDE重启才能生效识别decode):
a. 首先要增加一个转码的关键字,在Python2.7.12\Lib\site-packages\DatabaseLibrary文件夹下找到query.py文件,并在里面增加一段代码内容如下:
def decode(self, code):
??? return code.decode('utf-8')

(注:尽量不要把代码放在文件最后,我试过放在最后却不能编译通过)

b. 在python安装目录下的lib下的site-packages 目录中,新建文件sitecustomize.py。这是个特殊的文件,在python启动时会自动执行其中的语句。在sitecustomize.py中的语句sys.setdefaultencoding("UTF-8")的作用是将默认编码设置为"utf-8",样使用中文时就不会出现 UnicodeError错误。设置前的默认编码是ASCII。
sitecustomize.py示例如下:
#!/usr/bin/python
import sys
sys.setdefaultencoding('UTF-8')

4.adb devices错误提示:adb server is out of date,解决方案:https://blog.csdn.net/cgwang_1580/article/details/79840940

5. adb devices错误提示...offline,解决方案:
在做Android开发时经常出现android adb devices offline,解决办法如下:

1 重启adb服务
adb kill-server
adb start-server
linux下别忘了以root身份运行
2 上一步无效的情况下,将手机USB调试关闭后再次打开,重新执行上一步
3 仍旧不行的话,重启手机
4 到这步不行的话只能重启电脑了

6. appium错误提示WebDriverException: Message: Parameters were incorrect. We wanted {"required":["value"]} and you sent ["text","sessionId","id","value"],解决方案:
https://blog.csdn.net/wangjvv/article/details/80043022

7. 读excel乱码
在Python的Lib\site-packages文件夹下新建一个sitecustomize.py文件,内容为:
#coding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
重启Python解释器,发现编码已被设置为utf8