首先来说一说selenium,这是一个浏览器自动化测试框架。嗯。。。。就介绍这么多,要详细了解的话自己去看文档
诺~网址:https://www.seleniumhq.org/docs/
第一步需求分析:
1)自动搜索商品
2)获取搜索结果的数据
来个分割线
第二步上代码啊:
功能编写模块
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException,StaleElementReferenceException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from pyquery import PyQuery as pq
from config import *
import pymongo
import re
client = pymongo.MongoClien