Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

module 'selenium.webdriver' has no attribute 'PhantomJS'

I am running PhantomJS by

driver = webdriver.PhantomJS(executable_path='E:\phantomjs\bin\phantomjs.exe')

but the program fails, saying

AttributeError: module 'selenium.webdriver' has no attribute 'PhantomJS'.

OS is Windows 10. My python version is 3.6, selenium version is 3.8.0, and the phantomjs version is 2.1.1. All of them is newest.

Thanks if anyone could offer a hand!

Following is the screenshot of selenium version.

like image 560
Susu Avatar asked Jan 25 '26 00:01

Susu


1 Answers

I drew attention to this question while I was looking for an answer to it in google. It took me quite a lot of work to find the answer to it, so in order to save some work for others, and although a lot of time has passed since this question, I advise you not to use PhantomJS at this moment. On the official site of Selenium https://www.selenium.dev/documentation/getting_started/installing_browser_drivers/ you can read the quote: "PhantomJS is a headless browser based on Webkit, albeit a version much older than that used by Google Chrome or Safari. Whilst historically a popular choice, it would now be wise to avoid PhantomJS. The project has been unmaintained since the 5th of August 2017, so whilst the web will continue to change, PhantomJS will not be updated. This was after Google announced the ability to run Chrome headlessly, something also now offered by Mozilla’s Firefox.". I changed to Mozilla’s Firefox (I use it headlessly).

like image 133
Olgierd Wiśniewski Avatar answered Jan 27 '26 14:01

Olgierd Wiśniewski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!