You may extend your RemoteWebDriver class as below.
import java.io.File;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import java.util.Set;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.CommandExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.Response;
public class xRemoteWebDriver extends RemoteWebDriver {
private boolean debug = true;
public xRemoteWebDriver(CommandExecutor executor,
Capabilities desiredCapabilities, Log log) {
super(executor, desiredCapabilities);
}
public xRemoteWebDriver(Capabilities desiredCapabilities, Log log) {
super(desiredCapabilities);
}
public xRemoteWebDriver(URL remoteAddress,
Capabilities desiredCapabilities, Log log) {
super(remoteAddress, desiredCapabilities);
}
@Override
protected Response execute(String driverCommand, Map<String, ?> parameters){
printCommands(driverCommand, parameters);
return super.execute(driverCommand, parameters);
}
private void printCommands(String driverCommand, Map<String, ?> parameters){
System.out.print("\n");
if(isDebug()){
try{
System.out.print(driverCommand);
Set<String> keys = parameters.keySet();
for(String key : keys)
System.out.print("\t"+key + "\t" +parameters.get(key));
}catch(Exception ignore){
}
}
}
public boolean isDebug() {
return debug;
}
public void setDebug(boolean debug) {
this.debug = debug;
}
}