【发布时间】:2026-02-04 19:55:02
【问题描述】:
如何在 Google 或 Chrome 中设置 Selenium?
我都试过了,都没有成功。
它将在树莓派模型 b v1.1 上
【问题讨论】:
标签: python selenium firefox raspberry-pi selenium-chromedriver
如何在 Google 或 Chrome 中设置 Selenium?
我都试过了,都没有成功。
它将在树莓派模型 b v1.1 上
【问题讨论】:
标签: python selenium firefox raspberry-pi selenium-chromedriver
首先您需要安装 ChromeDriver,您可以从 here 获得它。之后,您需要使用pip install selenium 安装 selenium 库。开始吧
from selenium import webdriver
driver = webdriver.Chrome('/path/to/chromedriver') # Optional arg (will search current directory if not supplied)
driver.get('http://www.google.com/');
【讨论】:
Exception has occurred: MaxRetryError HTTPConnectionPool(host='127.0.0.1', port=65216): Max retries exceeded with url: /session/2f594c29cf83c6b4d367bb43277ac0f6/url (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002B665C049D0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
你好,这是一个很容易在 youtube 上搜索的问题,有很多视频可以正确解释这一点(例如如何创建 chrome PATH)
我认为这个视频是一个很好的起点 https://www.youtube.com/watch?v=Xjv1sY630Uc
谢谢。
【讨论】:
将chromedriver和python脚本放在同一目录
然后写:
from selenium import webdriver
browser = webdriver.Chrome()
driver.get('http://www.google.com/')
【讨论】: