Skip to content

Commit 7592347

Browse files
committed
Adding an option to run Chrome headless
1 parent acd0ad9 commit 7592347

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

java/client/src/org/openqa/selenium/chrome/ChromeOptions.java

+9
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ public ChromeOptions setUnhandledPromptBehaviour(UnexpectedAlertBehaviour behavi
214214
return this;
215215
}
216216

217+
public ChromeOptions setHeadless(boolean headless) {
218+
args.remove("--headless");
219+
if (headless) {
220+
args.add("--headless");
221+
args.add("--disable-gpu");
222+
}
223+
return this;
224+
}
225+
217226
/**
218227
* Returns DesiredCapabilities for Chrome with these options included as
219228
* capabilities. This does not copy the options. Further changes will be

0 commit comments

Comments
 (0)