How to save the logs generated using selenium with python

python, selenium, webdriver

Solution

The following will do the same for you. There is no internal logs for the python code.

from selenium import webdriver

p = webdriver.FirefoxProfile()   
p.set_preference("webdriver.log.file", "/tmp/firefox_console")
driver = webdriver.Firefox(p)

Problem

I am using web-driver 2.20 and created the automation suit. Unlike selenium RC (get_log function) i can't figure out the command to save the logs generated. I have tried : ``` FirefoxProfile p = new FirefoxProfile(); p.setPreference("webdriver.log .file", "/tmp/firefox_console"); WebDriver driver = new FirefoxDriver(p); ``` but can't find the python equivalent. Also http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/sel... this is also in java. Also I saw "import logging" function don't know how to save the logs in a file using it. Any suggestions ?

Original source