I am using selenium with python and want to access chrome dev tools.
I want to go into the sources tab and start coverage for the current page. After my selenium tests I want to download and save the coverage.json.
I have started by opening chrome with dev tools enabled, but I cant find a reliable way to continue.
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_argument("--auto-open-devtools-for-tabs")
browser = webdriver.Chrome(options=options)
I could mass send_keys until I am on the correct tab and count the tab keys from there until I am on the coverage tab and keep using this method, but it feels so hacky and unreliable. Isn't there a better way to do it? Atm. I have found nothing.
I can also execute JS in selenium with:
driver.execute("some js")
But I have also not found a way to do it with JS, is it even possible or do I search with the wrong keywords.
question from:
https://stackoverflow.com/questions/66065794/python-selenium-access-sources-tab-in-chrome-dev-tools 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…