Reputation: 116
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()
Upvotes: 0
Views: 1414
Reputation: 4264
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()
Upvotes: 1