Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions java/src/org/openqa/selenium/manager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ java_export(
],
deps = [
"//java/src/org/openqa/selenium:core",
"//java/src/org/openqa/selenium/json",
artifact("com.google.guava:guava"),
],
)
Expand Down
11 changes: 7 additions & 4 deletions java/src/org/openqa/selenium/manager/SeleniumManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.json.Json;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -55,7 +56,7 @@ public class SeleniumManager {

private static final String SELENIUM_MANAGER = "selenium-manager";
private static final String EXE = ".exe";
private static final String INFO = "INFO\t";
private static final String WARN = "WARN";

private static SeleniumManager manager;

Expand Down Expand Up @@ -112,9 +113,11 @@ private static String runCommand(String... command) {
throw new WebDriverException("Unsuccessful command executed: " + Arrays.toString(command) +
"\n" + output);
}

String[] lines = output.split("\n");
return lines[lines.length -1].replace(INFO, "").trim();
SeleniumManagerJsonOutput jsonOutput = new Json().toType(output,
SeleniumManagerJsonOutput.class);
jsonOutput.logs.stream().filter(log -> log.level.equalsIgnoreCase(WARN))
.forEach(log -> LOG.warning(log.message));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bonigarcia / @diemol can we log the debug information to LOG.FINE here? Is this the right place?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can do that.

return jsonOutput.result.message;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.openqa.selenium.manager;

import java.util.List;

public class SeleniumManagerJsonOutput {

public List<Log> logs;
public Result result;

public List<Log> getLogs() {
return logs;
}

public void setLogs(List<Log> logs) {
this.logs = logs;
}

public Result getResult() {
return result;
}

public void setResult(Result result) {
this.result = result;
}

public static class Log {
public String level;
long timestamp;
public String message;

public String getLevel() {
return level;
}

public void setLevel(String level) {
this.level = level;
}

public long getTimestamp() {
return timestamp;
}

public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}
}

public static class Result {
public int code;
public String message;

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}
}

}