Skip to content

Add --log-cdp / log_cdp=True options for capturing CDP logs #2220

Closed
@mdmintz

Description

@mdmintz

Add --log-cdp / log_cdp=True options for capturing CDP logs

If enabled, this happens:

chrome_options.set_capability(
    "goog:loggingPrefs", {"performance": "ALL", "browser": "ALL"}
)

Then you can do something like this to display those logs: (Eg. driver.get_log("performance"))

from seleniumbase import Driver

driver = Driver(uc=True, log_cdp=True)
try:
    driver.get("https://seleniumbase.io/")
    driver.sleep(3)
    print(driver.get_log("performance"))
finally:
    driver.quit()

Note that UC Mode also has separate --uc-cdp / uc_cdp=True options. That works differently. (See SeleniumBase/examples/uc_cdp_events.py for an example of that.)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions