Google Colab配置WebDriver时遭遇TypeError问题求助
Google Colab配置WebDriver时遭遇TypeError问题求助
各位大佬好,我刚接触Python,完全是新手,最近在Google Colab里配置Selenium WebDriver的时候遇到了TypeError,折腾了好久都没解决,想请教下大家怎么处理🙏
我在Colab里写的代码:
首先是安装依赖的命令:
!pip install selenium !apt-get update !apt install chromium-chromedriver
然后是Python代码:
from selenium import webdriver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') wh_chrome = webdriver.chrome(chrome_options= chrome_options) # 错误就出在这一行
错误跟踪信息:
TypeError Traceback (most recent call last) <ipython-input-23-9e2933988912> in <module> ----> 1 wh_chrome = webdriver.chrome(chrome_options= chrome_options) TypeError: 'module' object is not callable
我试过的解决方案:
- 把初始化代码改成了
driver = webdriver.Chrome('chromedriver', chrome_options=chrome_options),但还是有配置错误 - 也找了一些教程视频跟着操作,但每次配置WebDriver都会遇到各种问题
我完全没有Python基础,实在不知道该怎么弄了,麻烦各位大佬指点一下,谢谢大家!
备注:内容来源于stack exchange,提问作者Fabio Menezes
相关产品推荐
相关产品推荐

