

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get rid of Firefox logging in Selenium?
After the execution of tests, there are logs generated because of Firefox logging in with geckodriver. This log generation by Firefox can be disabled by certain parameters setting.
We can stop these logs from being recorded in the console and capture them in a different file. This is achieved with the help of the System.setProperty method. In the above image, we can see the geckodriver logs generated in the console.
Syntax
System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE, "true"); // turning off logs System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "<path of file>"); // record logs in another file
Example
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; public class LogsDisable{ public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\geckodriver.exe"); //logging disable System.setProperty (FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE, "true"); //record log in Firefoxlogs.txt file System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "C:\\Users\\ghs6kor\\Desktop\\DebomitaJava\\Logs\\Firefoxlogs.txt"); WebDriver driver = new FirefoxDriver(); //implicit wait driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //URL launch driver.get("https://www.tutorialspoint.com/about/about_careers.htm"); System.out.println("Page loaded"); driver.quit(); } }
Output
Firefoxlogs.txt file
File contents
- Related Questions & Answers
- How to get rid of smartphone addiction?
- How to get rid of Love Bites?
- How to get rid of split ends of hair?
- How to get Firefox working with Selenium WebDriver on Mac OSX?
- How to get rid of swollen fingers in winters?
- How to get rid of widget border in Tkinter?
- How to hide Firefox window (Selenium WebDriver)?
- How to get rid of dark circle under my eyes?
- How to set Proxy in Firefox using Selenium WebDriver?
- How to invoke the Firefox browser in Selenium with python?
- How to make firefox headless programmatically in Selenium with python?
- Which version of Firefox is compatible with selenium
- What is the importance of logging in Selenium with python?
- How does Selenium Webdriver handle SSL certificate in Firefox?
- How to Stop the page loading in firefox programmatically in Selenium ?
Advertisements