For chromium, in Puppeteer it is possible to block file downloads using the cdp command Page.setDownloadBehavior. Is there something similar for Firefox? Otherwise, it downloads all files automatically :(
Of course, I tried using Page.setDownloadBehavior for Firefox as well, but it throws an error:
Protocol error (Page.setDownloadBehavior): Page.setDownloadBehavior RemoteAgentError#chrome://remote/content/cdp/Error.jsm:29:5\nUnknownMethodError#chrome://remote/content/cdp/Error.jsm:112:7\nexecute#chrome://remote/content/cdp/domains/DomainCache.jsm:98:13\nreceiveMessage#chrome://remote/content/cdp/sessions/ContentProcessSession.jsm:84:45\n
I found a list of CDP support in Firefox and there is nothing there that could be somehow similar to what I need. Page.setDownloadBehavior, apparently, is only in the plans.
Related
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.
I have a big Selenium test suite that's testing a web service. Given an input url, the web service returns either a regular html response or a json response. The test suite is being executed with Firefox's Selenium IDE. The tests call the open command on a given url and then verify stuff on the returned json/html. It used to work great until for some reason Firefox has stopped opening the jsons automatically. Instead of opening the json response as if it were a regular web page, Firefox asks "What should Firefox do with this file" and prompts me to select a program to open the file with.
How do I force Selenium IDE to make Firefox display the json responses as it used to?
Cases like these are usually Firefox & Selenium IDE version incompatibility. This can be from using a much newer version or an old version of Firefox that the IDE doesn't quite support.
In your case it appears to be an older version issue.
The first step you should do is update both the IDE & Firefox and take it from there.
The release notes also detail what version (range) of Firefox it generally supports.
I'm trying to load unpack extension using command line flag --load-extension.
I'm using one chrome profile. The syntax for query is following:
chrome --load-extension="C:\Users\someUser\Desktop\unpackExtensionFolder"
Inside unpackExtensionFolder there is manifest.JSON and all sources.
This command doesn't work on few PCs in office, but it works on the rest of them, and successfully loads the extension (Chrome version is the same on all machines - 31, extension that we are trying to load is the same).
Discovered:
Doesn't depend on chrome profiles amount
Doesn't depend on developer mode on/off
The question is why? And what could have influence on this?
The reason for this was plugin inside manifest file, seems that chrome was not able to load extension with plugin declarated in it. Works fine after removing plugin section.
I'd like to be able to send info to the Chrome developer console from my application.
For example, my app has some json. I'd like this json to show up in either an existing, or newly created instance of the chrome dev tools console.
Is this possible? If so, any pointers to examples? Note that the platform should be any language, not just javascript. And definitely not a site already running in Chrome. I'm interested in implementing this in another process.
Do you thought of running your app in an environment which is pretty much like a browser?
Node.js
or (this is a whole webkit browser)
phantom.js
Otherwise you could call Chrome directly via commandline and try to simulate the dev tools key stroke like explained here:
Is there a command line argument in Chrome to start the developer tools on startup?
The command of displaying something in the Chrome console is e.g. console.log and it is at the end Javascript. All Console commands are described here:
https://developers.google.com/chrome-developer-tools/docs/console-api
The closest I've seen so far is this library:
https://github.com/ccampbell/chromelogger
which seems to allow logging to the Chrome Console from lots of other server side apis, but no desktop APIs.
This can be done on Mac using osascript. Save the following as a script and run it:
#!/usr/bin/osascript -l JavaScript
var chrome = Application('Google Chrome');
//chrome.activate();
chrome.includeStandardAdditions = true;
var currentTab = chrome.windows[0].activeTab()
currentTab.execute({javascript: 'console.log("Hello")'})
Am using Easeljs library. Everthing works fine in firefox and ie9 except in google chrome mouse events wont work and I got this error
"Uncaught An error has occured. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images."
Serve your page from a web server. Do not open the file from disk in chrome.
Another possibly working answer is:
var queue = new createjs.LoadQueue(true, null, true);
Since v.0.4.1, here's what they say:
The crossOrigin flag is already included in the LoadQueue()
constructor of v.0.4.1.
Just run you Chrome with --reduce-security-for-testing command-line argument. So you can develop your project locally without using web server.