keran
keran

Reputation: 113

How i can cut java stacktrace for selenium test?

Same actions for java

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Lol {
    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
        driver.get("http://suninjuly.github.io/simple_form_find_task.html");
        WebElement button = driver.findElement(By.id("submit"));
    }
}

and python

from selenium import webdriver


driver = webdriver.Firefox()
driver.get("http://suninjuly.github.io/simple_form_find_task.html")
button = driver.find_element_by_id("submit")

but stacktraces are very different it terms of information value:

i didnt paste stacktraces due to security reasons, but you can check blurred screenshots: https://i.sstatic.net/zsTLv.jpg

java stacktrace even does not fit in macbook 13' screen :c

How i can restrict printing unwanted information except actual trace?

Upvotes: 0

Views: 359

Answers (1)

AndiCover
AndiCover

Reputation: 1734

The problem with Firefox and Geckodriver is that it produces so many log entries which are not relevant for most users. To reduce the log entries in your Java program you have following options:

  1. Use a different Browser e.g. Chrome which produces less log entries.
  2. Redirect the Geckodriver log entries.

You can redirect the log entries of Geckodriver with following line to a file:

System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,"C:\\temp\\logs.txt");

For more information see this link.

Upvotes: 1

Related Questions