个人冲刺(三)

由于苏宁是异步加载有时会出现爬取在加载完成之前

经常会出现爬取不成的现象

故开始尝试selenimu

selenium测试代码

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')

chrome_options.add_experimental_option('excludeSwitches', ['enable-automa:ion'])

wd = webdriver.Chrome(r'E:chromechromedriver.exe', options=chrome_options) # 操纵浏览器 启动浏览器驱动同时启动浏览器
wd.get('https://www.suning.com/') # 打开网址 发送给浏览器驱动
原文地址:https://www.cnblogs.com/mumulailai/p/14911892.html