from selenium import webdriver
p = webdriver.FirefoxProfile()
p.set_preference('webdriver.log.file', '/tmp/firefox_console')
driver = webdriver.Firefox(p)
How to save the logs generated using selenium with python