0

I am using undetected_chromedriver bt its not printing log info like (Dev tool listening to...). I've used it previously and the same code was printing log info. Here is my code

def get_chromedriver():
    import undetected_chromedriver.v2 as uc
    browser = uc.Chrome(headless=True, executable_path="chromedriver.exe")
    browser.maximize_window()
    return browser

driver = get_chromedriver()
Huzaifa Farooq
  • 116
  • 1
  • 10

1 Answers1

1

As per the documentation, here is an example to get the Devtools log information print in the console. This is take straight from the documentation . You need to add the driver.add_cdp_listener() method with the appropriate params to print the logs from DevTools

import undetected_chromedriver.v2 as uc
from pprint import pformat
driver = uc.Chrome(enable_cdp_events=True)
driver.maximize_window()

def printmessage(message):
    print(pformat(message))

driver.add_cdp_listener("Network.requestWillBeSent",printmessage)

# to print all evenets
driver.add_cdp_listener('*', printmessage)


with driver:
    driver.get('https://workchronicles.com/comics/')

driver.quit()
demouser123
  • 4,108
  • 9
  • 50
  • 82
  • Thanks for answering. The this produces detailed output but not what I require. I just need the link that come after message (Dev tool listening to...). I just need general log info that usually get printed but for me its not printing that log info. – Huzaifa Farooq Sep 28 '21 at 05:09