0
我使用的硒的webdriver,以打開網頁獲取網頁消耗的帶寬?
vdisplay = Xvfb()
vdisplay.start()
fox = webdriver.Firefox()
fox.get(url)
有沒有辦法知道多少帶寬(MB)通過對下載的網頁消耗?
我使用的硒的webdriver,以打開網頁獲取網頁消耗的帶寬?
vdisplay = Xvfb()
vdisplay.start()
fox = webdriver.Firefox()
fox.get(url)
有沒有辦法知道多少帶寬(MB)通過對下載的網頁消耗?
使用BrowserMob Proxy API獲取打開的頁面下載大小和帶寬。 對於Python使用http://browsermob-proxy-py.readthedocs.org/en/latest/
使用它是足夠 簡單舉例來說,對於谷歌網頁
from browsermobproxy import Server
server = Server("path/to/browsermob-proxy")
server.start()
proxy = server.create_proxy()
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_proxy(proxy.selenium_proxy())
driver = webdriver.Firefox(firefox_profile=profile)
proxy.new_har("google")
driver.get("http://www.google.com")
proxy.har # returns a HAR JSON blob
server.stop()
driver.quit()
在從proxy.har最後將數據像http://www.softwareishard.com/har/viewer/
一個harviewer