获取浏览器请求的地址,和network差不多一致文章来源:https://www.toymoban.com/news/detail-761031.html
根据获取内容进行过滤文章来源地址https://www.toymoban.com/news/detail-761031.html
import json
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
caps = DesiredCapabilities.CHROME
caps['goog:loggingPrefs'] = {'performance': 'ALL'}
driver = webdriver.Chrome(desired_capabilities=caps)
driver.get('https://www.baidu.com/')
def process_browser_log_entry(entry):
response = json.loads(entry['message'])['message']
return response
browser_log = driver.get_log('performance')
print(type(browser_log))
events = [process_browser_log_entry(entry) for entry in browser_log]
events = [event for event in events if 'Network.responseReceived' in event['method']]
def flei(a):
for i in a:
if i['method'] == "Network.responseR
到了这里,关于selenium库获取浏览器请求链接(Network)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!