Reputation: 562
Okay so I am learning Web Scraping and am comfortable with Java hence I choose Jsoup, which is a web scraping library. I planned on scraping A CodeChef contest problem (which is just a coding problem), but I found difficulty scraping all the displayed content, which is not possible as most of it is dynamic source. So I used selenium to render the JavaScript and obtain simple HTML page and then feed it to JSOUP.
So I tried printing the rendered HTML page just to verify, but I get the following error when I run the code:
My Code:
File f = new File("<Path to chromedriver.exe>");
System.setProperty("webdriver.chrome.driver", f.getAbsolutePath());
WebDriver driver = new ChromeDriver();
driver.get("https://www.codechef.com/problems/FRGTNLNG");
System.out.println(driver.getPageSource());
Error (in chrome):
You are using an unsupported command-line flag: --ignore-certifcate-errors. Stability and security will suffer
I tried the following solution from Chrome Error: You are using an unsupported command-line flag: --ignore-certifcate-errors. Stability and security will suffer, I installed the latest chromedriver but it didn't resolve my error.
I also tried adding Desired Capabilities (now deprecated) and ChromeOptions as per Pass driver ChromeOptions and DesiredCapabilities?, but the same error persists.
Thanks in advance!
Upvotes: 4
Views: 3389
Reputation: 193058
The error says it all :
You are using an unsupported command-line flag: --ignore-certifcate-errors. Stability and security will suffer
As per best programming practices, use the ChromeOptions
Class to open Chrome Browser being maximized, disabling the infobars and disabling the extensions as follows :
System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
options.addArguments("disable-infobars");
options.addArguments("--disable-extensions");
options.addArguments("--test-type");
options.addArguments("--ignore-certificate-errors");
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.co.in");
Additionally, perform the following steps :
Upvotes: 4