1、创建项目 :Jd
2、middlewares.py中添加selenium
1、导模块 :from selenium import webdriver
2、定义中间件
class seleniumMiddleware(object):
...
def process_request(self,request,info):
# 注意:参数为request的url
self.driver.get(request.url)
3、settings.py
DOWNLOADER_MIDDLEWARES={"Jd.middleware.seleniumMiddleware":20}
转载于:https://www.cnblogs.com/zengsf/p/10050414.html