1.我们可能在爬取网页的时候遇到过下拉框的情况
他们将信息都放在了一个网页,但是不能通过网站的信息爬取到所需要的数据
2.使用selenium方法可以解决这个问题
使用selenium的方法,找到下拉框的属性,然后调用.click()方法可以进入到下拉框对应的界面
代码如下:
# -*- coding:utf-8 -*-
#@Time : 2019/12/21 10:12
from selenium import webdriver
from lxml import etree
from fake_useragent import UserAgent
import requests
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui