使用 selenium3 版本的时候

安装 selenium

pip install selenium==3.11.0

使用

from selenium import webdriver

driver = webdriver.Chrome(executable_path='chromedriver')
driver.get('https://www.baidu.com')

可以正常打开浏览器

最新想使用一下这个undetected-chromedriver
但是这个库最低得使用 selenium4.0 以上的版本

所有就更新了一下 selenium 版本

pip install --upgrade selenium

最后,就导致了使用 selenium 打不开浏览器的情况

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

driver = webdriver.Chrome(service=Service('chromedriver'))

就打不开了,500 Internal Privoxy Error

大佬们,有解决方法吗?

Traceback (most recent call last):
  File "/Users/Desktop/pythonProject/ttt.py", line 16, in <module>
    driver = webdriver.Chrome(service=Service('chromedriver'))
  File "/Users/Desktop/pythonProject/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/Users/Desktop/pythonProject/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in __init__
    super().__init__(
  File "/Users/Desktop/pythonProject/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 272, in __init__
    self.start_session(capabilities, browser_profile)
  File "/Users/Desktop/pythonProject/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 364, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Users/Desktop/pythonProject/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
  File "/Users/Desktop/pythonProject/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 207, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: <html>
<head>
 <title>500 Internal Privoxy Error</title>
 <link rel="shortcut icon" href="http://config.privoxy.org/error-favicon.ico" type="image/x-icon"></head>
<body>
<h1>500 Internal Privoxy Error</h1>
<p>Privoxy encountered an error while processing your request:</p>
<p><b>Could not load template file <code>no-server-data</code> or one of its included components.</b></p>
<p>Please contact your proxy administrator.</p>
<p>If you are the proxy administrator, please put the required file(s)in the <code><i>(confdir)</i>/templates</code> directory.  The location of the <code><i>(confdir)</i></code> directory is specified in the main Privoxy <code>config</code> file.  (It's typically the Privoxy install directory, or <code>/etc/privoxy/</code>).</p>
</body>
</html>


↙↙↙阅读原文可查看相关链接,并与作者交流