I'm trying to run a simple test on a headless browser. In my sample test when I take a screenshot I just get a blank screen when accessing my staging website, but production websites such as http://www.google.co.uk work correctly. So I guess we need to set headers in order to access our staging?
Does anyone know how to do this on selenium for a headless browser?
The code I have is:
public void testPhantom() throws IOException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "phantomjs");
Webdriver driver = new PhantomJSDriver(caps);
open("https://mywebsite.staging.com/");
takeAScreenshot("Website");
}
==================================================
UPDATE
Found the solution by reading this post: PhantomJSDriver works for HTTP but not for HTTPS