0

Headless mode is meant to be used on computers without screens, so how does PhantomJS and HtmlUnit figure out the maximized size ?

hemanik
  • 965
  • 3
  • 14
  • 33

1 Answers1

1

For HtmlUnit the (default) values are in WebClientOptions

private int screenWidth_ = 1024;
private int screenHeight_ = 768;

You can change this to any value you like:

final WebClient webClient = new WebClient(BrowserVersion.BEST_SUPPORTED);
webClient.getOptions().setScreenWidth(640);
webClient.getOptions().setScreenHeight(480);
RBRi
  • 2,704
  • 2
  • 11
  • 14