Skip to content

Commit

Permalink
[#321]Improvement: Add possibility to mute Selenium logs
Browse files Browse the repository at this point in the history
  • Loading branch information
oomelianchuk committed Dec 13, 2024
1 parent 3d943ae commit 5ebaf37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -195,6 +197,8 @@ public static WebDriverStateContainer createWebDriverStateContainer(final Browse
final MutableCapabilities capabilities = config.getCapabilities();
final WebDriverStateContainer wDSC = new WebDriverStateContainer();
SelenideProxyServer selenideProxyServer = null;
Logger.getLogger("org.openqa.selenium").setLevel(Level.parse(Neodymium.configuration().seleniumLogLevel()));

if (Neodymium.configuration().useLocalProxy())
{
final BrowserUpProxy proxy = setupEmbeddedProxy();
Expand Down Expand Up @@ -241,7 +245,7 @@ else if (Neodymium.configuration().useProxy())
var remoteDebuggingPort = PortProber.findFreePort();
Neodymium.setRemoteDebuggingPort(remoteDebuggingPort);
options.addArguments("--remote-debugging-port=" + remoteDebuggingPort);

if (config.getArguments() != null && config.getArguments().size() > 0)
{
options.addArguments(config.getArguments());
Expand Down Expand Up @@ -361,18 +365,18 @@ else if (edgeBrowsers.contains(browserName))

final String driverInPathPath = new ExecutableFinder().find("msedgedriver");
final EdgeOptions options = new EdgeOptions().merge(capabilities);

if (config.getArguments() != null && config.getArguments().size() > 0)
{
options.addArguments(config.getArguments());
}

EdgeBuilder edgeBuilder = new EdgeBuilder(config.getDriverArguments());
if (StringUtils.isNotBlank(driverInPathPath))
{
edgeBuilder.usingDriverExecutable(new File(driverInPathPath));
}

wDSC.setWebDriver(new EdgeDriver(edgeBuilder.build(), options));
}
else if (safariBrowsers.contains(browserName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,4 +393,8 @@ public interface NeodymiumConfiguration extends Mutable
@Key("neodymium.popupInterval")
@DefaultValue("1000")
public int getPopupBlockerInterval();

@Key("neodymium.seleniumLogLevel")
@DefaultValue("SEVERE")
public String seleniumLogLevel();
}

0 comments on commit 5ebaf37

Please sign in to comment.