Use pip install requests (or pip3 install requests for python3) if you have pip installed and Pip.exe added to the Path Environment Variable. If pip is installed but not in your path you can use python -m
windows系统下:
python 的 save_screenshot()默认保存路径是 C:\Users\Administrator
options = Options()
options.add_argument('-headless') # 无头参数
driver = Firefox(executable_path='geckodriver', firefox_options=options) # 配了环境变量第一个参数就可以省了,不然传绝对路径
效果:
首先安装selenium在上一篇文章已介绍
再安装geckodriver
可以在官网下载
https://github.com/mozilla/geckodriver/releases
python -m pip install selenium
如果不使用python -m 安装使用
from selenium import webdriver 会报错
以下代码为现敲,未测试
from selenium import webdriver
driver=webdriver.PhantomJS()
driver.get("https://www.baidu.com/")
driver.find_elem
BeautifulSoup可以从html或xml中提取数据的Python库。
通过BeautifulSoup解析html可以得到一个BeautifuSoup对象。
获得一个BeautifulSoup对象:
from bs4 import BeautifulSoup as bs
driver = webdriver.PhantomJS()
drive