2

Hello I want try load website with PhantomJS

from selenium import webdriver
driver = webdriver.PhantomJS(executable_path="/Users/martinzuffa/phantomjs-2.5.0-beta-macos/bin/phantomjs")
driver.get("www.google.com")
print(driver.page_source)

Here is the error

Traceback (most recent call last): File "/Users/martinzuffa/PycharmProjects/pythonProject/main.py", line 8, in driver = webdriver.PhantomJS(executable_path="/Users/martinzuffa/phantomjs-2.5.0-beta-macos/bin/phantomjs") File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 52, in init self.service.start() File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 96, in start self.assert_process_still_running() File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 107, in assert_process_still_running raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: Service /Users/martinzuffa/phantomjs-2.5.0-beta-macos/bin/phantomjs unexpectedly exited. Status code was: -9

1 Answer 1

1

PhantomJS was deprecated in Selenium 3.8.1

* PhantomJS is now deprecated, please use either Chrome or Firefox in headless mode

Additionally, Selenium 4.1.0 packages doesn't contain the PhantomJS module anymore:

PythonModules


Solution

As an alternative you have to use either of the following:

1
  • Hi, Can Firefox or Chrome use authenticated proxy in selenium headless mode? Commented Nov 22, 2022 at 11:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.