- Download chromedriver, extract the binary as
chromedriver
to the current directory - Run
pip install -r requirements.txt
- Run
python test.py
- Try to load the
snap.heapsnapshot
file into Chrome Dev Tool's Memory tool (Memory -> Load)
Last active
November 23, 2020 08:47
-
-
Save nolanlawson/01e7358f682dde01e9cb27f777acf195 to your computer and use it in GitHub Desktop.
Test chromedriver heap snapshot
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
selenium==3.141.0 |
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
import time | |
from selenium import webdriver | |
import json | |
service = webdriver.chrome.service.Service('./chromedriver') | |
service.start() | |
driver = webdriver.Remote(service.service_url, {}) | |
driver.get('http://example.com'); | |
time.sleep(2) | |
res = driver.execute_script(':takeHeapSnapshot') | |
fileout = open('snap.heapsnapshot', 'wb') | |
fileout.write(json.dumps(res)) | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to also :ClassFilter heap snapshot and save only filtered object in json format?....Where can I find the list of all available execute_script commands? :)