from selenium import webdriver
    
    driver = webdriver.PhantomJS(executable_path='/path/to/download/phantomjs-2.1.1-macosx/bin/phantomjs')
    driver.get('http://pythonscraping.com/')
    driver.get_screenshot_as_file('temp.png')
    

    参考:《Python网络数据采集》