webdriver.chrome() TypeError: 'module' object is

我正在python3中开发亚马逊网络抓取脚本,所以我使用了硒,但我得到了这个调试


webdriver.chrome()

TypeError: 'module' object is not callable 

我看到了更改的解决方案(铬到铬),但我也有这个调试


FileNotFoundError: [WinError 2] The system cannot find the file specified

这是我的代码


# -*- coding: utf-8 -*-

import requests

from bs4 import BeautifulSoup

from selenium import webdriver


driver = webdriver.chrome()

driver.get('https://www.amazon.com/international-sales-offers/b/?ie=UTF8&node=15529609011&ref_=nav_navm_intl_deal_btn')

res = driver.execute_script("return document.documentElement.outerHTML")

driver.quit()

soup = BeautifulSoup(res , 'lxml')

box= soup.find('div',{'class':'a-row padCenterContainer widgetBorder'})

products=box.find_all('div',{'class':'a-section a-spacing-none tallCellView gridColumn5 singleCell'})

for details in products:

    name= details.find('span',{'class':'a-declarative'}).text

    link= details.find('a',{'class':'a-size-base a-link-normal dealTitleTwoLine singleCellTitle autoHeight'}).get('href')

    print(name,link)


LEATH
浏览 168回答 1
1回答

开满天机

我相信它应该是,而不是。尝试:Chrome()chrome()from selenium import webdriverdriver = webdriver.Chrome()您也可以将路径传递给Chromedriver,将executable_path设置为chromedriver所在的位置(路径,或者,对于非Windows用户,它只称为):chromedriver.exechromedriverdriver = webdriver.Chrome(executable_path='C:/path/to/chromedriver.exe')
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python