1、yaml文件写的是:

platformVersion: 10

2、driver初始化:

data = yaml.load(file, Loader=yaml.FullLoader)
desired_caps = {}
desired_caps['platformVersion'] = data['platformVersion']

3、运行后报错:selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): 'platformVersion' must be of type string

4、报错原因是因为platformVersion的value是“10”,经data调用后不是字符串类型了,所以会报错'platformVersion' must be of type string,加个str转换一下就好了:

desired_caps['platformVersion'] = str(data['platformVersion'])

5、重新运行,错误消失

python如何解决报错:‘platformVersion’ must be of type string相关推荐

  1. python解码bash64报错:binascii.Error: Invalid base64-encoded string: number of data characters (7121) can

    文章目录 报错信息 产生过程 问题产生原因(失败,报错不是这个问题) 20230223 问题产生原因2:base64编码数据是错误的 报错信息 binascii.Error: Invalid base ...

  2. python xlwt 解决报错:ValueError: More than 4094 XFs (styles)

    解决方案 对于设置样式的函数: def define_style():font = xlwt.Font()font.colour_index = 1# 初始化样式my_style = xlwt.XFS ...

  3. 解决报错TypeError:unsupported operand type(s) for +: ‘NoneType‘ and ‘str‘

    文章目录 一.问题描述 二.解决方案 Reference 一.问题描述 from pyspark.sql.types import StringType@udf(returnType = String ...

  4. golang 返回值报错 cannot use nil as type string in return argument

    在刚刚开始使用golang写代码的时候,经常会放错.给一个变量放回一个nil,这个通常编译的时候不会报错,但是运行是时候会报cannot use nil as type string in retur ...

  5. python selenium解决报错SessionNotCreatedException session not created: No matching capabilitie与问题解析

    解决方法 查看导包是否正确: 如果是webdriver.Chrome,那么导包的一切都要是chrome的 如果是webdriver.Firefox,那么导入的包也都源于firefox的包 出现这个问题 ...

  6. python导入openpyxl报错问题,终于解决啦

    python导入openpyxl报错问题,终于解决啦 参考文章: (1)python导入openpyxl报错问题,终于解决啦 (2)https://www.cnblogs.com/guotang/p/ ...

  7. Python 中文注释报错解决方法

    Python 中文注释报错解决方法 参考文章: (1)Python 中文注释报错解决方法 (2)https://www.cnblogs.com/cjiong/p/5881983.html 备忘一下.

  8. python安装报错类型_解决Python安装cryptography报错问题

    解决Python安装cryptography报错问题 错误一: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wst ...

  9. 神奇的python(五)之python强制退出报错(异常)解决方法

    简介:python程序在执行时,有时候由于某些模块冲突或者是定时器冲突,会出现很多奇怪的错误,为此我们需要让python程序在退出时免受这些问题的干扰. (1) 常用的信号类型: SIGINT 终止进 ...

最新文章

  1. 【实习项目记录】(一)加密算法MD5和RSA
  2. 浅析企业网站从何开始了解百度蜘蛛?
  3. 蓝桥杯 黄金连分数(BigDecimal的使用)
  4. jszip压缩服务器文件,使用JSZip压缩驻留在服务器上的PDF
  5. pip install pygame_使用 Python 和 Pygame 模块构建一个游戏框架!
  6. RabbitMQ—为什么使用信道channel
  7. 两个iphone怎么大量传照片_「唯物」传个视频到 iPhone,有了新方法
  8. android spi读写不通,Android-SPI学习笔记
  9. 民营医院网络咨询解答技巧
  10. vs 2019怎么运行单个的cpp文件以及报错main已存在解决方法
  11. h5混合开发框架初识
  12. 怎样在线将图片转换成icon图标
  13. 刚体运动学公式_1.力的观点 ⑴.匀变速直线运动中常见的公式: 牛顿第二定律: 运动学公式:.... ⑵.圆周运动的主要公式:...
  14. UDP数据丢包跟踪与总结
  15. javascript 字符串的排列与组合
  16. C/C++编程学习 - 第3周 ⑥ 温度表达转化
  17. 第六章第九题(英尺和米之间的转换)(Conversions between feet and meters)
  18. 显示计算机101代码,电脑出现蓝屏故障101停机码,怎么解决问题
  19. android pc模拟器哪个好用,电脑手游安卓模拟器哪个好用流畅 好用的安卓模拟器...
  20. 想要创业,却没货源?答应我,别只在阿里妈妈上找了好吗

热门文章

  1. Java输出语句中“+”的作用
  2. 私有云和公有云的主要区别有几点?两者哪个更安全?
  3. python导入requests报错_import requests报错
  4. 【洛谷 1348】Couple number
  5. 旅行路径记录android,记录旅途每个脚印 Android软件在路上
  6. jzoj 5904. 【NOIP2018模拟10.15】刺客信条 二分+并查集
  7. ios11,新系统,新bug
  8. 视频线的种类和简单介绍
  9. css 相对定位 position relative
  10. RAC 管理(crs_stat、crsctl、srvctl)