1

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

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Martin žuffa
  • 21
  • 1
  • 5

1 Answers1

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:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352