环境搭建好后,代码如下:
from selenium import webdriver
driver = webdriver.chrome()
driver.get("http://www.baidu.com") ele = driver.find_element_by_id("kw") ele.send_keys("chromedriver") 运行报错:
E:\ll\py_workspace\venv\Scripts\python.exe E:/ll/py_workspace/test.py
Traceback (most recent call last):
File "E:/ll/py_workspace/test.py", line 4, in <module>
driver = webdriver.chrome()
TypeError: 'module' object is not callable
Process finished with exit code 1
错误原因:
driver = webdriver.chrome()
谷歌浏览器Chrome单词C大写。
修改为:driver = webdriver.Chrome()
正常运行。