I am trying to run the application in chrome headless mode using the below code, while providing the application as Google.com the code runs fine, whereas when providing the actual application under test URL I get a blank page. Any idea how to rectify this?
Code:
ChromeOptions options = new ChromeOptions();
Options.addArguments("--headless");
Webdriver driver = new ChromeDriver(options);
driver.get("https://www.google.com");
System.out.println(driver.getTitle());
Chrome Version is 66.
According to the discussion on this thread , there are only two differences.
options.add_argument("user-agent=XXX")
to override the user agent setting and see whether it solves the issue. Thank you for the answers, i was able to resolve this looks the application that i was accessing has security error and any application running in headless chrome if it has security error opens a blank page this is how we can handle it.
Code ChromeOptions options = new ChromeOptions(); DesiredCapabilities capabilities = DesiredCapabilities.chrome(); Capabilities.setAcceptInsecureCerts(true); Options.merge(capabilities);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.