我想在亚马逊的交易页面中废弃所有产品(40),但只得到16个产品,我进行了很多搜索,发现我应该使用滚动条,但是我得到了相同的值,但是滚动条不起作用
代码
# -*- coding: utf-8 -*-
import requests
import time
from bs4 import BeautifulSoup
from selenium import webdriver
driver = webdriver.Chrome(executable_path='C:\\Users\\Compu City\\Desktop\\chromedriver.exe')
driver.get('https://www.amazon.com/international-sales-offers/b/?ie=UTF8&node=15529609011&ref_=nav_navm_intl_deal_btn')
time.sleep(10)
res = driver.execute_script("return document.documentElement.outerHTML",'window.scrollBy(0,2000)')
soup = BeautifulSoup(res , 'lxml')
for x in soup.find_all('a',{'class':'a-size-base a-link-normal dealTitleTwoLine singleCellTitle autoHeight'}):
for y in x.find_all('span',{'class':'a-declarative'}):
print('\n >>>'+y.text+'\n')
driver.close()