Created
April 5, 2024 15:13
-
-
Save jgs03177/d75a1f020271cebb867124f7712df487 to your computer and use it in GitHub Desktop.
http request analysis with selenium, without fiddler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# request analysis with selenium, without fiddler | |
# references: | |
# https://stackoverflow.com/a/63732179 | |
# https://stackoverflow.com/a/27644635 | |
# https://stackoverflow.com/a/69931030 | |
from selenium import webdriver | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
import json | |
options = webdriver.ChromeOptions() | |
options.set_capability("goog:loggingPrefs", {'performance': 'ALL'}) | |
target_link = "https://google.com" | |
driver = webdriver.Chrome(options=options) | |
driver.get(target_link) | |
logs = driver.get_log('performance') # dump perf logs | |
for entry in logs: | |
msg = json.loads(entry['message'])['message'] | |
if msg['method']=="Network.requestWillBeSent": | |
print(msg) | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment