简体   繁体   中英

What is the easiest way to get chrome browser console logs with Selenium python

What is the easiest way to get chrome console js errors with Selenium python

This is what i am using but I am not able to get full error message

results = (self.driver.get_log('browser'))
print results

Here is working:

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

dc = DesiredCapabilities.CHROME
dc['goog:loggingPrefs'] = { 'browser':'ALL' }

driver = webdriver.Chrome(desired_capabilities=dc)
driver.implicitly_wait(30)

for entry in driver.get_log('browser'):
    print(entry)
 
driver.quit()

Maybe this will help? Looks like you need to pass on the desired capabilities before getting the log.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM