当前位置:网站首页>已解决(最新版selenium报错)AttributeError: module ‘selenium.webdriver‘ has no attribute ‘PhantomJS‘
已解决(最新版selenium报错)AttributeError: module ‘selenium.webdriver‘ has no attribute ‘PhantomJS‘
2022-07-20 06:33:00 【无 羡ღ】
已解决(最新版selenium报错)AttributeError: module ‘selenium.webdriver’ has no attribute ‘PhantomJS’
报错信息
我的代码:
from selenium import webdriver
browser = webdriver.PhantomJS()
# 发送请求
browser.get('https://www.baidu.com/')
# 打印页面的标题
print(browser.title)
# 退出模拟浏览器
browser.quit() # 一定要退出!不退出会有残留进程
报错信息:
Traceback (most recent call last):
File "E:/Python学习/1.py", line 3, in <module>
browser = webdriver.PhantomJS()
AttributeError: module 'selenium.webdriver' has no attribute 'PhantomJS'
报错翻译
报错翻译:AttributeError:模块“selenium”。“webdriver”没有属性“PhantomJS”
报错原因
报错原因:新版的 selenium已经放弃PhantomJS,所以才会出现module ‘selenium.webdriver’ has no attribute ‘PhantomJS’。PhantomJS安装都是最新版本,pip install selenium安装的也是最新版本。
解决方法
1. 先把selenium卸载,代码如下:
pip uninstall selenium
2.安装selenium==2.48.0版本的,代码如下:
pip install selenium==2.48.0
具体操作截图:
3. 再次运行成功:
边栏推荐
- RNA 23. Risk factor association diagram of Cox model of expressed genes in SCI articles (ggrisk)
- Excel中万能的查询函数——VLOOKUP(使用方法+实操)
- 学会如何选择图表类型,小白也能玩转数据分析
- Getting started with native threejs
- 定义一个描述圆的类,然后生成一个圆对象,最后输出半径、直径和面积。
- VAE图片生成实战
- LeetCode刷题--点滴记录016
- Network security architecture: axiom of security architecture
- 自编码器(Auto-Encoder)
- DNA 9. Uncover the correlation between tumor heterogeneity and TMB, MSI
猜你喜欢
与传统IT开发相比,低代码平台有何优势?
One dimensional convolution English film review emotion classification project
Principle and protection of DOM XSS
Dynamic password lock based on stm32
SDL practice in agile development mode
C language file operation management (Part 2)
Use Excel to make Gantt chart to track project progress (with drawing tutorial)
文末送书|豆瓣9.4分,“hello,world”起源于这本书!
搞懂这些关键指标,数据分析起码少费一半力
超全干货:数据可视化的设计总结,工具,技术要点统统都有
随机推荐
在 IDEA 里下个五子棋不过分吧?
Access数据库对象包括哪六个?Access与 Excel 最重要的区别是什么?
Hibernate method to prevent SQL injection attack
欲戴王冠,必承其重。
游戏实现——扫雷
Dynamic password lock based on stm32
Super dry goods: design summary, tools and technical points of data visualization are all available
DNA 10. Identify oncodrivecluster
[latex] miktex+texstudio installation and configuration of thesis writing environment
三地五中心(ldc(逻辑数据中心)单元化)和容灾
The latest upx3.91 supports win64 / PE plus / minus shell
安全开发之IP地址伪造
自编码器(Auto-Encoder)
网络安全架构:安全架构公理
C language file operation management (Part 1)
FigDraw 12. Correlation matrix of SCI article drawing
nc (NetCat) 网络安全工具介绍
学会如何选择图表类型,小白也能玩转数据分析
编写一个Book类,该类至少有name和price两个属性。
通俗解释: IaaS,PaaS和SaaS的区别