autoit open firefox and activate addon - firefox

I am new AutoIT. I see it has a lot of potential.
How can I write autoit code to open FireFox from specific location and inside it activate addon. Then the autoit code would navigate to a link?
I have some examples but it has been less then 1 hour since I started working on autoit.
My goal is to change FireFox profiles, run links inside each of those and close Firefox.exe after some time...

You can run the FireFox.exe to just bring the browser up (here is the documentation on that) and there is a FireFox AutoIt library available

You can use any of the below command to run your browser or any file
ShellExecute("filename")
or
Run( "The full path of the program f.ex- any exe or bat file")

Related

How to make my browser (such as Firefox) open a custom File Manager?

My system is Windows 11 build 22621. Now I use Tablacus Explorer to manage my files instead of Explorer.exe, however, many apps (such as Firefox or Control Panel) will still use Explorer.exe when I try to open directory or other something in those apps,even though I used some Tablacus's plugins such as Shell Execute Hook.
Are there better methods to let other apps to auto open Tablacus as more as possible?
Add "Open Instead" and "System Tray" plugin to solve the problem.

Forcing a launcher to be opened with Internet Explorer

Ok, I've read here and here that is not possible, on a gerneral browser, to force a link to be opened in IE.
So my question is: can I do it with a desktop launcher?
Extended question: Can I easily create a desktop launcher on Windows (10, 7 and maybe older versions) that if double clicked opens a specific URL in IE?
You can create a batch file to run the command to open IE with a specific url. You can create a .bat file and put the following code in the file:
start iexplore "http://www.bing.com"
Double click the .bat file, then it will open IE with Bing website.
Result:

How to open a link in chrome from cmd (Windows) without bringing chrome window to foreground?

For example if I click on a link in vscode editor it does not interfere with what I am currently doing - opens it without making chrome window active.
I want to achieve the same from command line from windows using one of: cmd, msys bash, powershell.
There is a similar question answered but without foreground requirement.
Haven't tried it but with PowerShell you can try :
Start-Process -WindowStyle Hidden "chrome.exe" "www.google.com"
or
Start-Process -WindowStyle Minimized "chrome.exe" "www.google.com"
I see a solution here, however there seem to be no direct way to open links in chrome without bringing chrome window to foreground.
Use Chrome Remote Debugging Protocol. The browser has to be run with param --remote-debugging-port=9222. Actually, all instances of chrome have to be closed first. Then chrome can be controlled via this API. There is a client for it in most major languages, e.g. node:chrome-remote-interface.
I believe this is how also vscode does it, however they can do it even without remote-debugging-port parameter on the chrome instance.
So to complete the task in my original question, u need only to write some script that makes use of installed Debugging Protocol client of your choice.
Update: this also brings chrome to foreground (only if the window is hidden behind another window it doesn't). For definitive solution use chrome extension with tabs API (I am afraid this is necessary).
You can just Create one text file with .bat extension in windows OS.
Then you can write path where your Chrome is present and then you can write Chrome.exe and then give the link as argument which you want to open.
For Example,
cd C:\Program Files (x86)\Google\Chrome\Application
chrome.exe www.yahoo.com
I hope it will help you.

Open a Web Page in a Windows Batch FIle

I have a batch file that does a bunch of things and at the end needs to open up a web browser to a page. Is there a way to, in essence, call ShellExecute on a http to open the web page?
Windows Command Prompt
You can use the start command to do much the same thing as ShellExecute. For example
start "" http://www.stackoverflow.com
This will launch whatever browser is the default browser, so won't necessarily launch Internet Explorer.
1.To run from the default browser, use
start http://www.stackoverflow.com
Please make sure that the appropriate browser is set as default at Control Panel-> default program :
2.To launch page from specific browser, one can use
start "iexplore.exe" http://www.stackoverflow.com
start "chrome.exe" http://www.stackoverflow.com
start "firefox.exe" http://www.stackoverflow.com
Unfortunately, the best method to approach this is to use Internet Explorer as it's a browser that is guaranteed to be on Windows based machines. This will also bring compatibility of other users which might have alternative browsers such as Firefox, Chrome, Opera..etc,
start "iexplore.exe" http://www.website.com
When you use the start command to a website it will use the default browser by default but if you want to use a specific browser then use start iexplorer.exe www.website.com
Also you cannot have http:// in the url.
hh.exe (help pages renderer) is capable of opening some simple webpages:
hh http://www.nissan.com
This will work even if browsing is blocked through:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer
start did not work for me.
I used:
firefox http://www.stackoverflow.com
or
chrome http://www.stackoverflow.com
Obviously not great for distributing it, but if you're using it for a specific machine, it should work fine.

How to handle File Download pop up in Firefox using AutoIT in (selenium RC)

I need to download a file from application in my selenium RC test.
When i click on the link/button to save a file, first i get a pop up which asks me to either open or save the file, when i select 'Save' and click 'OK' then i get one more pop up asking me to provide the path where file is to be saved and file name also.
I goggled and found that this could be done via AutoIT but i am facing some problems while doing that.
so could some one please provide me the .exe file for file_download in Firefox and also where i can mention the path to save that file too.
and also if you could provide me what exactly the code, i need to write in my test case.
Please let me know how to handle this.
You can achieve that without using autoit also. follow below steps.
Create new firefox profile.
Change the preferences in that profile manually before starting the automation with that profile. (Change the settings like below)
Now start the automation using that profile so that files will be downloaded to default location.
Starting selenium server using specfic profile
java -jar selenium-server.jar -firefoxProfileTemplate "C:\Users\UserName\AppData\Roaming\Mozilla\Firefox\Profiles\234saddsf.customProfile"
I found this link: http://qtp-help.blogspot.com/2009/07/selenium-handle-dialogs.html
Unfortunately it is for the old style dialog boxes that do not have the open vs save radio buttons. I'm searching for a solution to this part of the problem.

Resources