from selenium import webdriver
from selenium.webdriver import ChromeOptions
from selenium.webdriver.common.keys import Keys
import time
# 输入搜索的关键字
key_words = input("这位客官!请您输入要在京东查询爬取的商品:")
# 用这个跳过谷歌浏览器的自动化检测
option = ChromeOptions()
option.add_argument('disable-infobars')
#定义一个get方法
def get_goods(driver,key_words):
number = 400
# 一直循环当前页面,使其加载完成后跳到下一页
for line in range(20):
js = 'window.scrollTo(0,%s)' % number
number += 500
driver.execute_script(js)
time.sleep
python爬取京东商品页面信息
最新推荐文章于 2024-05-13 00:44:01 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)