5.1selenium

selenium主要用于抓取动态界面的信息

from selenium.webdriver import Chrome
web = Chrome()
web.get("http://lagou.com")

大致这样使用,之后就会打开浏览器

点击按钮

btn = web.find_element_by_xpath('//*
[@id="changeCityBox"]/ul/li[1]/a') # 找到全国按
钮
btn.click() # 点击这个按钮

输入框搜索

# 找到⽂本框输⼊python, 点击搜索按钮
web.find_element_by_xpath('//*
[@id="search_input"]').send_keys("python")
web.find_element_by_xpath('//*
[@id="search_button"]').click()
原文地址:https://www.cnblogs.com/zhaoyids/p/14905123.html