【发布时间】:2022-01-22 23:24:43
【问题描述】:
您好,我想尝试使用 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)
这是错误
Traceback(最近一次调用最后一次):文件 “/Users/martinzuffa/PycharmProjects/pythonProject/main.py”,第 8 行,在 driver = webdriver.PhantomJS(executable_path="/Users/martinzuffa/phantomjs-2.5.0-beta-macos/bin/phantomjs") 文件 “/usr/local/lib/python3.9/site-packages/selenium/webdriver/phantomjs/webdriver.py”, 第 52 行,在 init 中 self.service.start() 文件“/usr/local/lib/python3.9/site-packages/selenium/webdriver/common/service.py”, 第 96 行,开始 self.assert_process_still_running() 文件“/usr/local/lib/python3.9/site-packages/selenium/webdriver/common/service.py”, 第 107 行,在 assert_process_still_running 中 引发 WebDriverException(selenium.common.exceptions.WebDriverException:消息:服务 /Users/martinzuffa/phantomjs-2.5.0-beta-macos/bin/phantomjs 意外退出。状态码是:-9
【问题讨论】:
标签: python selenium phantomjs selenium4 selenium-webdriver-python