3

I'm using PhantomJs Ghostdriver with Java to take some screenshots of the webpages. My problem is that PhantomJs are using locale from the host machine, so I need to set default language. I have found how to do it for Chrome Driver and for Firefox, but can't find the solution for Ghostdriver.

Any hints?

Djordje Ivanovic
  • 4,151
  • 4
  • 27
  • 49

1 Answers1

6

As per this issue and this pull request (and tested, of course):

DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(PHANTOMJS_PAGE_CUSTOMHEADERS_PREFIX + "Accept-Language", "it-IT");
WebDriver driver = new PhantomJSDriver(caps );

The constant above is at org.openqa.selenium.phantomjs.PhantomJSDriverService.PHANTOMJS_PAGE_CUSTOMHEADERS_PREFIX.

Don't forget to change the language from it-IT to whatever you need.

acdcjunior
  • 132,397
  • 37
  • 331
  • 304