Skip to content

Commit

Permalink
Update DriverOptions.java
Browse files Browse the repository at this point in the history
πŸš€ Custom chrome options added.
🐞 Fixed a issue with workingDir that mistakenly create new directories when userDataDir was defined.
  • Loading branch information
luizvaz authored Aug 16, 2020
1 parent 6dc6d28 commit 9a5fd37
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public class DriverOptions {
public final Logger driverLogger;
public final String uniqueName;
public final File workingDir;
public final boolean disableNotifications;
public final String userAgent;
public final String userDataDir;
public final String processLogFile;
public final int maxPayloadSize;
Expand Down Expand Up @@ -167,12 +169,20 @@ public DriverOptions(ScenarioContext context, Map<String, Object> options, LogAp
args.add(executable);
}
}
workingDir = new File(FileUtils.getBuildDir() + File.separator + uniqueName);
if (options.containsKey("userDataDir")) { // special case allow user-specified null
userDataDir = (String) options.get("userDataDir");
disableNotifications = get("disableNotifications", false);
userAgent = get("userAgent", null);
String place = get("userDataDir", null);
if (place != null) { // special case allow user-specified null
if (place.startsWith(".")){
workingDir = new File((new File(place)).getAbsolutePath());
} else{
workingDir = new File(place);
}
userDataDir = workingDir.getAbsolutePath();
} else {
workingDir = new File(FileUtils.getBuildDir() + File.separator + uniqueName);
userDataDir = workingDir.getAbsolutePath();
}
}
processLogFile = workingDir.getPath() + File.separator + type + ".log";
maxPayloadSize = get("maxPayloadSize", 4194304);
target = get("target", null);
Expand Down

0 comments on commit 9a5fd37

Please sign in to comment.