from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
ca = DesiredCapabilities.CHROME
ca["goog:loggingPrefs"] = {"performance": "ALL"}
driver = webdriver.Chrome(desired_capabilities=ca)
driver.get("http://www.baidu.com")
logs = driver.get_log("performance")
print(logs)
print('-----------')
aaa = driver.execute_script("return window.performance.getEntries(); ")
print(aaa)
# print(logs[0])
方法一,返回的是浏览器的
info
级别日志
> 方法二返回的数据量较少发送请求