|
Post by leiwang on Sept 11, 2020 8:02:29 GMT
Sometimes user wants to enable/disable the chrome flag before running test with chrome browser. If we open a chrome manually and type "chrome://flags" in the address bar, we can see the "flags" shown as below: If we want to set flag "temporary-unexpire-flags-m83" to "Disabled" with SeleniumPlus, we can create a file "chromeExperimental.dat" containing the following content { "localState" : { "browser.enabled_labs_experiments" : ["temporary-unexpire-flags-m83@2"] } } Then we can start the browser by API StartWebBrowser as below: StartWebBrowser(url, browserID, SelectBrowser.BROWSER_NAME_CHROME, ..., SelectBrowser.KEY_CHROME_EXPERIMENTAL_OPTIONS, "chromeExperimental.dat")
Then we see that the launched chrome's flag "temporary-unexpire-flags-m83" is disabled To set the flag to "Enabled", we add @1 at the end of the flag, for example "temporary-unexpire-flags-m83@1"; To set the flag to "Default", we add @0 at the end of the flag, for example "temporary-unexpire-flags-m83@0". If we want to set multiple flags, we can modify the json file "chromeExperimental.dat" to add more flags, example as below { "localState" : { "browser.enabled_labs_experiments" : ["temporary-unexpire-flags-m83@2", "same-site-by-default-cookies@0", "cookies-without-same-site-must-be-secure@1"] } } [Reference] stackoverflow.com/questions/60538265/how-can-i-disable-chrome-experimental-option-same-site-by-default-cookies-in-jav
|
|
|
Post by leiwang on Sept 16, 2020 0:24:13 GMT
Our user found that if we disable the flag "same-site-by-default-cookies", then there is always a save password pop-up when starting the chrome browser. To avoid this problem, our user also found a way out: "add 'credentials_enable_service=false' in our chrome preference file"
We have the preference file "ChromePrefs.dat" as below:
{ "seplus.chrome.preference.json.key": { #The preferences are given as key:value "credentials_enable_service" : false, } }
Then we can call StartWebBrowser as below:
StartWebBrowser(url, browserID, SelectBrowser.BROWSER_NAME_CHROME, ..., SelectBrowser.KEY_CHROME_EXPERIMENTAL_OPTIONS, "chromeExperimental.dat", SelectBrowser.KEY_CHROME_PREFERENCE, "ChromePrefs.dat")
|
|