aquality-automation / aquality-selenium-dotnet

Aquality Selenium is a library built over Selenium WebDriver tool that allows to automate work with web browsers. Selenium WebDriver requires some skill and experience. So, Aquality Selenium suggests simplified and most importantly safer and more stable way to work with Selenium WebDriver.
Apache License 2.0
47 stars 14 forks source link

Add possibilities to enable logging by using settings.json file #223

Closed DmitryBogatko closed 1 year ago

DmitryBogatko commented 1 year ago

ChromeDriver is able to consume the logging preferences as below:

var chromeOptions = (ChromeOptions)driverSettings.DriverOptions;
chromeOptions.SetLoggingPreference(LogType.Performance, LogLevel.All);

Is it possible to use such kind of settings via settings.json? I have tried to add into options (and into capabilities too) following:

capabilities.setCapability("goog:loggingPrefs", logPrefs); 

But it seems this way it is not possible. As result, currently I see the only one way to set these preferences - to implement custom browser factory.

mialeska commented 1 year ago

Instead of implementing custom browser factory, the simpliest way is to implement CustomBrowserProfile overriding DriverSettings property, and register it in the DI container (CustomStartup).