Is it possible to make it so I can put the user script that I made on my website and users to instal it simply by clicking on it (on firefox and chrome)?
And if it is possible how do I do it?
And how do I put my user script in chrome manually? In firefox it is simple, I just click on greasemonkey icon and select "new user script". But I simply can't figure out how to do it in chrome and couldn't find the answer online.
For me this looks like a really simple thing to do, but from some reason I can't find the answer by googling. Am I using a bad key word or something? idk.
Is it possible to make it so I can put the user script that I made on
my website and users to instal it simply by clicking on it (on firefox
and chrome)? And if it is possible how do I do it?
Yes. Just insert an ordinary download link such as
Click here to download my script!.
Please note prospective users should have Greasemonkey (Firefox) or Tampermonkey (Chrome) installed. Also, filename of the script should end with .user.js.
Example
And how do I put my user script in chrome manually? In firefox it is
simple, I just click on greasemonkey icon and select "new user
script". But I simply can't figure out how to do it in chrome and
couldn't find the answer online.
Use Tampermonkey.
Related
I'm using Selenium with VBA and Microsoft Edge to collect information, and download some files from a webpage. Everything works great except for the downloading part.
On this example site: https://file-examples.com/index.php/sample-documents-download/sample-doc-download/, Code like
oWebDriver.FindElementByXPath("//a[#href=""https://file-examples-com.github.io/uploads/2017/02/file-sample_100kB.doc""]").Click
will result in a popup like this:
Unfortunately, it is not possible to simply change the browser's preferences in my case, because the macro will be running on a machine with limited authorization and the following setting can not be changed:
The last option can be translated to: "Ask for the storage location with every download" and it is locked.
It seems that the "Save As" popup in the first screenshot can't be accessed, neither with Selenium nor with SendKeys.
So the only option seems to be using the Windows API with VBA to somehow automate this step, however, even so, it seems to be impossible to get a handle on this pesky popup. I tried finding the window with Spy++ and it doesn't seem to show up as a separate window:
The only solution I can now think of is getting the window size of the parent Edge browser window, navigating the mouse to the approximate position of the "Save As" button, and clicking it there using VBA and the Windows API. Obviously, This is not a great solution, as it would be quite frail and can easily break with the smallest misalignment.
Is there any other way to automate this step that doesn't require moving the mouse and automating the "manual" clicking, using only VBA with Selenium?
Selenium only works for browser web page automation. The pop-up is not a part of the wab page so Selenium will not be able to recognize it.
And I think any setting in Selenium including "download.prompt_for_download" won't have effect. The pop-up is controlled by the browser setting, and the browser setting is controlled by your group policy, you can't override it with Selenium settings.
I think the only way is to use some 3rd party UI automation library to click that option along with Selenium, just like what you said in the question.
I am writing a script for web automation with SELENIUM and, in theory, I have two options to capture the data I need from the websites I am scraping:
I can let the script extract relevant information from each tag on the result pages.
I can make the script click on the browser extension button in my browser window and let the extension manage the data for me.
I know how to extract information by HTML tag, but when it comes to browser extensions, I have only found instructions how to install / uninstall them with SELENIUM, but no instructions how to "activate" them once they are installed.
I am using Firefox and would be very grateful if you could point me in the right direction.
I was not able to solve this problem in FIREFOX but in CHROME:
I created a browser profile including my extension and a key shortcut to activate it.
I opened that profile when starting the browser with SELENIUM.
I used SELENIUM to navigate to the right URL.
I used pyautogui to press the relevant keys and trigger the file download.
I use two different Chrome profiles (users) on my laptop: one for my work stuff and one for my personal browsing.
Sometimes I click a link from HipChat and it opens it in the personal profile even though it's for work (e.g. login.work.com). (This is because I happen to have been in my personal chrome window most recently.)
I'd like to make a chrome extension I can install in my personal profile to match the URLs of *.work.com and send these over to the work profile window.
I haven't found a way to open a url into a different profile. Anyone know of a way?
(A hacky idea I got from reading https://superuser.com/a/289618 is maybe I could shell out to something along the lines of google-chrome --user-data-dir=$work_profile, but I'd be happier if there was a JS API and I didn't have to ask permission to run programs on the user's computer.)
Dropping an answer in case it's still useful to anyone.
I built my chrome extension CopyTabs (https://chrome.google.com/webstore/detail/copytabs/obkbjogekcjalnaebheboejhfkamadkg) to do something similar. It is able to open links, current tabs, selected tabs or windows, in the current chrome user profile, another chrome user profile or another browser entirely.
I made use of chrome.exe --profile-directory="profileName" to open URLs in a selected profile, but this has a handler that runs on the user's machine, with profileName being the internal name of the chrome profile, for example --profile-directory="Profile1" instead of --profile-directory="My Name As Profile".
So to answer your question, no I don't think there's anyway around a local handler on the user's machine to achieve this functionality.
Though the question is an old one but maybe someone is looking for an answer.
In the new versions of chrome when you right click on a link, in the pop-up menu, there is an option to open the link in another profile. For this to work, ofcourse, there need to be multiple user profiles in Chrome.
Works like a charm!
Hope it helps.
There is no solution for this. It would need a handler, a separate program, that captures the URL before it reaches Chrome, parses your preferences for which URLs go to which profile and then starts the specified Chrome installation with specified profile flags.
However, afaik, such a program does not exist (at least on Windows).
Further, Chrome cannot even select which profile out of many is selected, when Chrome is started from the OS "call URL to be opened" function and NOT started by user-activated clicking on a Chrome application shortcut (with specific profile selection instructions).
Naturally, the latter works 100% wonderfully on Firefox, which has built-in profile selector after the browser has been started, and regardless of which method was used to start Firefox (user click on Firefox icon or OS pipe of "open URL" to Firefox).
So; no solution in Chrome.
I believe that Account Surfer should be able to do the things that you're looking for. Here's an overview from Windows store:
Quickly switch between accounts and browsers with Account Surfer.
Decide what account or browser to use when opening the link.
Read more:
https://dospolov.com/posts/handle-chrome-profiles-with-account-surfer
https://trello.com/b/QOLCmlg3/account-surfer-roadmap
Yes u can:
install extension like this https://chrome.google.com/webstore/detail/open-in-ms-edge/mjoebkkejejidnkfdekpbooceogbapnf
copy address of profile (for example: C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --profile-directory="Profile 2)
Insert it in settings of extension
profit
OR
Use Browser Chooser 2
The app finicky did the trick for me. You can check out this link for installation and configuration for the same.
Finicky example configuration
Does anybody know a way I can automate the right click and save as actions for IE, Chrome and Firefox?
I am doing some selenium work using Maven and need to be able to download some files but I am unable to do this as the save as windows cannot (to my knowledge) be automated by Selenium as they are OS dialogs.
I disagree with Bob, Bill and the author of the article that is linked to in the other answer.
Downloads can be automated. The downloaded file can be meaningfully verified. In simplest case you can compare the contents of downloaded file with an existing exemplary file.
(Disclaimer: the next paragraph is about a tool which I am affiliated with).
For example if you use RIATest for automation you can automate the right click, then automate the OS dialog, then wait until the download is finished and verify the content of the downloaded file.
I'm new to Dreamweaver CS4 and making my first website. I've watched a lot of tutorials and they all just click the Preview in Browser button and they can see what their page looks like in Firefox/IE/etc.
But when I click Preview in Browser a new Firefox window opens up and it goes to my homepage and that's it.
What do I need to setup in order be able to preview in firefox?
THANKS!
I don't use Dreamweaver, although I have it as part of CS4. But I just now opened up the app, created a test HTML page, saved it, and hit F12 (Preview in Browser). And there was my test page. I honestly don't know what you could be doing wrong. I thought it might be that you didn't save your file, but you get a warning dialog if you try to preview without doing that.
After some playing around I fixed the problem myself.
First I had to go to manage site and edit the basic preferences on my website.
I had to make sure the 'URL to browse to the root of your site" is valid.
In my case it I had to add:
file:///C:/Documents%20and%20Settings/Linda/My%20Documents/website1/