Add webdriver.edge.* system properties for customizing logging.
These mimic the properties used by other driver services in the Selenium standalone server, e.g., webdriver.chrome.logfile and webdriver.gecko.logfile.
import org.openqa.selenium.remote.service.DriverService;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
*/
public static final String EDGE_DRIVER_EXE_PROPERTY = "webdriver.edge.driver";
+ /**
+ * System property that defines the default location where MicrosoftWebDriver output is logged.
+ */
+ public static final String EDGE_DRIVER_LOG_PROPERTY = "webdriver.edge.logfile";
+
+ /**
+ * Boolean system property that defines whether the MicrosoftWebDriver executable should be started
+ * with verbose logging.
+ */
+ public static final String EDGE_DRIVER_VERBOSE_LOG_PROPERTY = "webdriver.edge.verboseLogging";
+
public EdgeDriverService(File executable, int port, ImmutableList<String> args,
ImmutableMap<String, String> environment) throws IOException {
super(executable, port, args, environment);
@@ -70,14 +82,30 @@ protected File findDefaultExecutable() {
ImmutableList.Builder<String> argsBuilder = ImmutableList.builder();
argsBuilder.add(String.format("--port=%d", getPort()));
+ if (Boolean.getBoolean(EDGE_DRIVER_VERBOSE_LOG_PROPERTY)) {
+ argsBuilder.add("--verbose");
+ }
+
return argsBuilder.build();
}
+ @Override
protected EdgeDriverService createDriverService(File exe, int port,
ImmutableList<String> args,
ImmutableMap<String, String> environment) {
try {
- return new EdgeDriverService(exe, port, args, environment);
+ EdgeDriverService service = new EdgeDriverService(exe, port, args, environment);
+
+ if (getLogFile() != null) {
+ service.sendOutputTo(new FileOutputStream(getLogFile()));
+ } else {
+ String logFile = System.getProperty(EDGE_DRIVER_LOG_PROPERTY);
+ if (logFile != null) {
+ service.sendOutputTo(new FileOutputStream(logFile));
+ }
+ }
+
+ return service;
} catch (IOException e) {
throw new WebDriverException(e);
}
