Print without confirmation on google chrome - google-chrome

Is there a way to ignore the confirmation dialog box of chrome when press ctrl+p (Version 31.0.1650.63 m). I tried adding "--kiosk --kiosk-printing" flags to the end of the “Target:” field. But It gives an error msg.
"The name 'C\Program Files\Google\Chrome\Application\chrome.exe --kiosk --kiosk-printing' specified int the target box is not valid. Make sure the path and file name are correct."
Any one can help?

Check this and follow the steps:
Launch Chrome and check that the Chrome Version is at the latest version (18.0.1 or higher )
Type about:flags in the address bar and ensure that the Disable Print Preview flag is NOT enabled (Print preview must be enabled for Kiosk Printing to work)
Close the browser
Find the browser shortcut on your desk top, right click and select 'properties'
Append the following text to the end of the target field: --kiosk --kiosk-printing
Save, and launch Google Chrome. It should now load in full screen (kiosk) mode
The print preview will appear on your screen, but will instantly print a receipt to your default printer.
Reference

You need to make edits to the target when Chrome is completely off, Chrome is not enough to close.
Open task manager, go to processes, find Chrome, end the process, then do your own edits, and when you open Chrome the way you want it to work.
So :
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-print-preview
Or
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --kiosk-printing

Related

Unable to modify value of "prompt_for_download" in chrome preferences file

Gurus,
I am using uipath(A Ui Based Automation Tool) to download a file from a website using chrome browser.
I want browser to not prompt before downloading and just download the file in the downloads folder.
From various posts on this website i found that there exists a file called "preferences" which can be modified to solve this problem.
Before coding further i decided to do the changes in the "preferences" file manually on multiple machines, just to make sure that the changes i do in the preferences file reflect in the chrome browser as well .
I am manually modifying values for these 2 options in the preferences file.
download.default_directory
download.prompt_for_download
When i changed value for download.default_directory(Manually in Preferences file), it reflects the same in the chrome browser settings on every machine that i tested on.
But When i change value for download.prompt_for_download, it reflected in the chrome browser settings on some of the machines while on others i found that it does not reflect in the browser and rather the preferences file also seems to have reverted back to previous values.
The steps i followed are as below..
close any running instance of chrome
do the modifications in the preference file and save it
open chrome and go to settings>advance and downloads
i see DreamCatcher pointing to a similiar situation in this post, but no answers there..
I hope I can help solve your issue or at least give you some direction :)
Option#1: Chrome Settings
Wouldn't the problem be solved by changing the settings for downloads in the browser before running the bot? https://support.google.com/chrome/answer/95759?co=GENIE.Platform%3DDesktop&hl=en
Option#2: Do it in UiPath
And the other thing, is that when the prompt (to save the file) appears, couldn't you insert the path of the file that includes the default folder to save + name file + extension? (e.g. on the save path of the prompt, use type text "c:\myDocuments\downloads\filename.ext" ? I've done this in the past with UiPath...get the prompt window, type text and just modify the string being passed to carry the path, file name and extensio...then click "SAVE" or use hotkey "Enter"(if the file requires replacement, these are another 20cents you will have to program in UiPath, but it'd doable).
Option#3: Script
Another option, which I have not done, but see my friends do is creating BAT files to reset certain browser settings or the "registry"...so what they do is that they configure the BAT to do the changes to the browser and they add an activity (in UiPath) to invoke the BAT file every time the browser is opened by the robot.
Links for reference:
https://superuser.com/questions/59465/is-it-possible-to-download-using-the-windows-command-line
https://getadmx.com/?Category=Chrome&Policy=Google.Policies.Chrome::DownloadDirectory

How to disable “always open these types of links in the associated app” using a registry key

I have created a custom registry to launch few Urls in IE browser from Chrome.I have used below code.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\ie]
"URL Protocol"=""
#="URL:IE Protocol"
[HKEY_CURRENT_USER\Software\Classes\ie\shell]
[HKEY_CURRENT_USER\Software\Classes\ie\shell\open]
[HKEY_CURRENT_USER\Software\Classes\ie\shell\open\command]
#="cmd /c set url=\"%1\" & call set url=%%url:ie:=%% & call start iexplore -nosessionmerging -noframemerging %%url%%"
But i am getting a warning window as "always open these types of links in the associated app" before launching IE from chrome.
I am looking for the way to disable this warning window using chrome registry protocol handlers.
The below solutions is for selenium. But am looking similar kind of solution using Registry settings
How to disable "always open these types of links in the associated app" Chrome alert
Any help would be appreciated.
Thanks
I know you wanted a solution using registry keys to make "always open these types of links in the associated app" to disappear but I am providing a solution using Chrome preferences file.
Following line needs to be added in the Chrome Preferences file to disable the popup completely without being displayed when a link or exe is being launched.
"protocol_handler":{"excluded_schemes":{"XYZ":false}}
Note: XYZ is a protocol name of your app (through which the link is being opened), which you can get it from "HKEY_CLASSES_ROOT" in registry editor

"unsafely-treat-insecure-origin-as-secure" flag is not working on Chrome

I am using geo-location for a site running locally on my machine using HTTP on Chrome. However this does not work as I am running on HTTP as opposed to HTTPS.
On the console it says:
getCurrentPosition() and watchPosition() no longer work on insecure origins.
To use this feature, you should consider switching your application to a
secure origin, such as HTTPS. See https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins
for more details.
Accoriding to Deprecating Powerful Features on Insecure Origins its says to start chrome using --unsafely-treat-insecure-origin-as-secure="http://example.com" flag. The command I ran was similar to:
chrome.exe --unsafely-treat-insecure-origin-as-secure="http://hello.app"
However, the same error message still appears.
How can I fix this issue.
None of the solutions worked for me.
I achieved this by following steps.
Type chrome://flags/#unsafely-treat-insecure-origin-as-secure in the address bar.
Add the origin which you need to treat as secure as shown in the below image.
Relaunch chrome.
You must have missed some steps. Try to follow this
Go to File Explorer then paste this to address bar >> C:\Program Files (x86)\Google\Chrome\Application (or just go to where you can find your chrome.exe)
Right click chrome.exe > send to > Desktop (Create Shortcut)
Go to your desktop then find the chrome shortcut you've created.
Rename it to ChromeForTesting (this step is optional)
Right click the shortcut, then Click Properties
At the "Target", paste the following at the end of the link
--user-data-dir=/tmp/foo --unsafely-treat-insecure-origin-as-secure=http://example.com
so Target should look somewhat similar to this
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=/tmp/foo --unsafely-treat-insecure-origin-as-secure=http://example.com
Click Ok..
During testing close all of your opened google chrome browser.
Then double click ChromeForTesting shortcut (the one you've created), when a prompt appears, just click ok..
EDIT: If the steps above does not work for you, you might be using Chrome V63, update it to V64 above cause this flag is messed up in V63.
P.S. If it's still not working follow these extra steps
At your drive C, create a folder and name it "ChromeTempFiles".
Then in your --user-data-dir= you change the value into "C:\ChromeTempFiles"
Add these to your target as well
--allow-running-insecure-content --reduce-security-for-testing
so your target should look like this now
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\ChromeTempFiles --unsafely-treat-insecure-origin-as-secure=http://example.com --allow-running-insecure-content --reduce-security-for-testing
You should also use a temproary fresh profile for that session. something like this:
chrome.exe --user-data-dir=/test/only/profile/dir --unsafely-treat-insecure-origin-as-secure="http://example.com"
Just an update to this for Chrome 70. This works perfectly
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\ChromeTempFiles --allow-running-insecure-content
Now does anybody know if there is an equivalent for firefox?
For Chromium 44 use
--unsafety-treat-insecure-origin-as-secure=http://192.168.0.101:3000
instead
--unsafely-treat-insecure-origin-as-secure=http://192.168.0.101:3000
See that bug
In Google Chrome, you simply type into the address bar, "chrome://flags", and search for, "--unsafely-treat-insecure-origin-as-secure", enable that flag, and enter into the field below (multiples may be entered separated by a comma) the domain you wish to treat as secure. This may or may not compromise your security, but I would assume not as getCurrentPosition() and watchPosition() are somewhat recently deprecated features. this works for publicly served domains, as well.
With Chrome 79 this setting doesn't work no matter what.
What I ended up doing was to configure the domain on a VPS to show some test webpage and then generate a valid certificate for it using Let's Encrypt's certbot.
Then I copied that certificate to my machine and it's now valid.

What is the difference between manually opened Chrome browser and opened using chrome driver

I am using Selenium for automating the chrome browser. When I download the files using automated Chrome browser it gives me a warning,
'This type of file can harm your computer' with keep or discard options.
But when I manually open chrome and download the files from same site, I won’t get any warnings.
I know I can disable the warnings using, options.AddUserProfilePreference("safebrowsing.enabled", true);
But my question is why I am getting this warning only in automated window?
What is the difference between browser opened using Chrome driver and manually opened browser?
Please help me.
If during your manual download, in your chrome
Settings > Advance Settings
Privacy -> Protect you and your device from dangerous sites (is_checked)
The download warning wouldn't be displayed on your browser.
On the other hand, not all chrome options are set to the same value during automatic download from your code. Hence you need to specify :
options.AddUserProfilePreference("safebrowsing.enabled", true);
List of all command line arguments for chrome driver goes here.
Note : Though not all of them are certainly of use while using automation and not all of them correspond to a chrome manual setting either.

When downloading a browser, how does the "browser-side" "set as your default browser" setting work?

When installing Google Chrome, the web page asks your whether you want to set up Google Chrome as a default browser:
This being a form submitted to the server, how does the result of this checkbox make it into the final installation on the client, if at all?
Does the checkbox only tell the server to send a different installer? Or is this possibly just a social experiment where the checkbox has no effect, but the results are being aggregated and analysed?
For Chrome specifically, I just tried downloading both installers (with and without the "default" option) and found that they do indeed differ.
$ cmp ChromeSetup.exe ChromeSetup2.exe
ChromeSetup.exe ChromeSetup2.exe differ: byte 405, line 4