changing chrome logging level

871 views
Skip to first unread message

DG

unread,
Aug 29, 2017, 4:51:14 AM8/29/17
to Serenity BDD Users Group
Hi

I want to read JavaScript console error from chrome selenium UI tests.
getDriver().manage().logs().get(LogType.BROWSER).getAll()
By default i get only Errors so i have to increase chrome logging level.
I do not have custom driver to do something like that

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
LoggingPreferences loggingprefs = new LoggingPreferences();
loggingprefs
.enable(LogType.BROWSER, Level.ALL);
capabilities
.setCapability(CapabilityType.LOGGING_PREFS, loggingprefs);

how to change chrome logging level from serenity.properties file or how is the best way to achieve my goal?

Prashant Maniktala

unread,
Sep 14, 2017, 12:51:34 PM9/14/17
to Serenity BDD Users Group
This is exactly what I am looking for as well. If someone has figured this out, please share. 

John Smart

unread,
Sep 14, 2017, 12:57:03 PM9/14/17
to Prashant Maniktala, Serenity BDD Users Group
This is not currently supported. If anyone would like to give it a go, the code to modify would be in the ChromeDriverCapabilities class

--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-users+unsubscribe@googlegroups.com.
To post to this group, send email to thucydides-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
___________________________________________________
John Smart | Wakaleo Consulting  |  +44 7398 832273
Making smart teams collaborate better
http://johnfergusonsmart.com  |  john....@wakaleo.com
___________________________________________________

We love breaking down silos and helping smart teams collaborate better! Ask about our tailored on-site workshops in Agile Product Planning, BDD Requirements Discovery,  BDD, TDD and Clean Coding, and Advanced BDD Test Automation.

Need some help with Serenity BDD? Check out our Serenity BDD training and support packages here.
___________________________________________________

Prashant Maniktala

unread,
Sep 15, 2017, 5:07:55 PM9/15/17
to Serenity BDD Users Group
I added the highlighted to the existing ChromeDriverCapabilities class and work good. 

public DesiredCapabilities getCapabilities() {
        DesiredCapabilities capabilities = DesiredCapabilities.chrome();
        ChromeOptions chromeOptions = this.configuredOptions();
        LoggingPreferences logPrefs = this.configuredLoggingPrefs();
        capabilities.setCapability("chromeOptions", chromeOptions);
        capabilities.setCapability("loggingPrefs", logPrefs);
        String chromeSwitches = this.environmentVariables.getProperty(ThucydidesSystemProperty.CHROME_SWITCHES);
        capabilities.setCapability("chrome.switches", chromeSwitches);
        AddCustomCapabilities.startingWith("chrome.capabilities.").from(this.environmentVariables).to(capabilities);
        return capabilities;
    }


    private LoggingPreferences configuredLoggingPrefs() {
        LoggingPreferences logPrefs = new LoggingPreferences();
        logPrefs.enable("browser", Level.ALL);
        logPrefs.enable("performance", Level.ALL);
        return logPrefs;
    }

Note: LoggingPreferences were not able capture the fetch() api calls. If someone figures out how to make that work, that would be awesome.

On Tuesday, August 29, 2017 at 3:51:14 AM UTC-5, DG wrote:
Reply all
Reply to author
Forward
0 new messages