Python 类型错误:';模块';使用selenium webdriver打开chrome浏览器时,对象不可调用
我试图使用python-selenium.webdriver打开和关闭chrome浏览器,但我发现了以下错误,我使用的是ubuntu系统 我下载了chrome浏览器驱动程序,并在代码中提供了相同的路径 我得到以下错误: 文件“/home/rupesh/PycharmProjects/Selenium/Selenium-package/test1.py”,第3行,在 driver=chrome('/home/rupesh/Downloads/chromedriver\u linux64/chromedriver') TypeError:“模块”对象不可调用 代码如下:Python 类型错误:';模块';使用selenium webdriver打开chrome浏览器时,对象不可调用,python,selenium,selenium-chromedriver,Python,Selenium,Selenium Chromedriver,我试图使用python-selenium.webdriver打开和关闭chrome浏览器,但我发现了以下错误,我使用的是ubuntu系统 我下载了chrome浏览器驱动程序,并在代码中提供了相同的路径 我得到以下错误: 文件“/home/rupesh/PycharmProjects/Selenium/Selenium-package/test1.py”,第3行,在 driver=chrome('/home/rupesh/Downloads/chromedriver\u linux64/chrom
from selenium.webdriver import chrome
driver = chrome ('/home/rupesh/Downloads/chromedriver_linux64/chromedriver')
driver.close()
driver对象以大写的Chrome开头:
from selenium.webdriver import Chrome
driver = Chrome('/home/rupesh/Downloads/chromedriver_linux64/chromedriver')
根本原因-1)驱动程序对象以小写“chrome”开头
2) chrome web驱动程序和chrome版本不同,chrome是Selenium中的一个子模块;它不是一个可调用的函数。但是如果我再次运行同一个程序,我会得到以下错误反馈(最后一次调用):文件“/home/rupsh/PycharmProjects/Selenium/Selenium package/test2.py”,第3行,在driver=Chrome(“/home/rupsh/Downloads/chromedriver\u linux64/chromedriver”)文件中“/home/rupsh/PycharmProjects/Selenium/venv/lib/python3.6/site packages/Selenium/webdriver/chrome/webdriver.py”,init-desired_capabilities=desired_capabilities)文件/home/rupsh/PycharmProjects/Selenium/venv/lib/python3.6/site packages/Selenium/webdriver/remote/webdriver.py”第69行,init self.start_会话第92行(所需的功能,浏览器配置文件)可能使用
driver.quit()
而不是driver.close()
来正确关闭一切?完成!!!错误是chrome驱动程序78,我使用的是chrome 69,因此兼容性问题,因此我升级到chrome 78,现在它可以正常工作了。