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 ?
To implement logging in Python, we have to import package logging by adding the statement import logging in our code. This is by default available with Python and we don't have to download any external plugin for that. Next we have to create an object of the logging class with the help of the getLogger method.
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)
Thanks it worked after setting:
p.set_preference("webdriver.log.file", "/tmp/firefox_console")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With