Post by leiwang on Jun 10, 2021 6:22:59 GMT
- Download Chromium and chromedriver
We can download them from storage.googleapis.com/chromium-browser-snapshots/index.html,
here I choose storage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win_x64/890985/ to download,
within that page, click the link "chrome-win.zip" to download chromium; click "chromedriver_win32.zip" to download the chromedriver.
Once downloaded,
we will have "Win_x64_890985_chrome-win.zip", extract it to "C:\Win_x64_890985_chrome-win"
we will also have "Win_x64_890985_chromedriver_win32.zip", extract it to "C:\Win_x64_887479_chromedriver_win32",
then copy "C:\Win_x64_887479_chromedriver_win32\chromedriver_win32\chromedriver.exe" to "C:\SeleniumPlus\extra"
- Create a chrome options JSON file
Create a file "c:\\chromeExperimentalOptions.json" with content {"binary" : "C:\\Win_x64_890985_chrome-win\\chrome-win\\chrome.exe" }
- Start the browser
Call SeleniumPlus StartWebBrowser with parameter (..., SelectBrowser.KEY_CHROME_EXPERIMENTAL_OPTIONS, "c:\\chromeExperimentalOptions.json")
The sample code is as below:
String experimentalOptionsFile = "c:\\chromeExperimentalOptions.json";//A json file containing chrome experimental options {"binary" : "C:\\Win_x64_890985_chrome-win\\chrome-win\\chrome.exe" }
StartWebBrowser("http://www.google.com", "GoogleMain", new String[]{
SelectBrowser.BROWSER_NAME_CHROME,
"10",
"true",
quote(SelectBrowser.KEY_CHROME_EXPERIMENTAL_OPTIONS),
quote(experimentalOptionsFile)
});
References:
Chrome Options
ChromeOptions.setBinary() to run chromium
Chromium browser versions