Is there a way to disable the logs created by the pagefactory



  • Could someone please let me know if there is any way we can disable the logs generated by the page factory for Chrome and Firefox

    I did try the below options for chrome and firefox and I had also turned off the Selenium logs.

    Selenium - java.util.logging.Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);
    
    Chrome - System.setProperty("webdriver.chrome.silentOutput", "true");
    
    Firefox - System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE, "true");
                    System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "/dev/null");
    ```
    
    
    

    But inspite of that these logs are still getting displayed.

    Thanks in advance.

    enter image description here

    Please find below the code:

    public class LoginPage {

    ``` @FindBy(xpath = "//input[@id='txtUserName']") WebElement textfield_UserName; @FindBy(xpath = "//input[@id='txtPassword']") WebElement textfield_Password; @FindBy(xpath = "//div/button[@id='btnSave']") WebElement button_Login; public LoginPage() { super(); } public void loginPageDisplayed(String userName, String password) throws IOException { try { if (!status.equalsIgnoreCase("Failed")) { PageFactory.initElements(driver, this); BasePage.waitUntilElementIsVisible(label_LoginPage); BasePage.sendKeysToWebElement(textfield_UserName, userName); BasePage.sendKeysToWebElement(textfield_Password, password); BasePage.waitAndClickElement(button_Login); } } catch (Exception e) { e.printStackTrace(); } } ```

    }



  • PageFactory does not print out selectors by default. So it is probably something you added yourself in the base class.

    A good way to research this is to use step-by-step debugging in your IDE. Set a breakpoint where you use the selector. Run the tests in debug-mode and from then use the step in option to see what code is being executed. Eventually you should run into a line of code that prints the selector.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2