废弃核燃料 2023-02-16 23:51 采纳率: 100%
浏览 137
已结题

unittest报错问题

unittest报错
想问一下大家这是哪里错了?
我看视频博主跟我一样为什么我的就不能运行

img

C:\Users\Sherl-W\anaconda3\envs\pythonProject\python.exe "C:/Program Files/JetBrains/PyCharm Community Edition 2021.1.3/plugins/python-ce/helpers/pycharm/_jb_unittest_runner.py" --target demo2 
Testing started at 23:49 ...
Launching unittests with arguments python -m unittest demo2 in C:\Users\Sherl-W\PycharmProjects\pythonProject


进程已结束,退出代码0
C:\Users\Sherl-W\anaconda3\envs\pythonProject\lib\site-packages\selenium\webdriver\remote\remote_connection.py:418: DeprecationWarning: HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).
  if resp.getheader('Content-Type') is not None:
C:\Users\Sherl-W\anaconda3\envs\pythonProject\lib\site-packages\selenium\webdriver\remote\remote_connection.py:419: DeprecationWarning: HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).
  content_type = resp.getheader('Content-Type').split(';')

  • 写回答

3条回答 默认 最新

  • GISer Liu 2023-02-17 02:12
    关注

    以下答案引用自GPT-3大模型,请合理使用:

    如何修改
    这是由于selenium中,底层使用urllib3在处理http请求,相关的相应头操作已被移除,所以报出以上warning。
    可以在报错的文件(remote_connection.py)的相关行内,把getheader()替换为headers.get()即可。
    如把:
    if resp.getheader('Content-Type') is not None:
    替换为:
    if resp.headers.get('Content-Type') is not None:
    
    同理,
    content_type = resp.getheader('Content-Type').split(';')
    替换为:
    content_type = resp.headers.get('Content-Type', '').split(';')
    

    如果我的回答解决了您的问题,请采纳我的回答

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 2月25日
  • 已采纳回答 2月17日
  • 创建了问题 2月16日

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭