How to handle File Download pop up in Firefox using AutoIT in (selenium RC) - 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.

Related

Is there a way to automate webpage login and download report?

Is there a way to automate a task a webpage login and download report maybe with power-automate or some other method?
open web page
enter any parameters.
click download button.
save download to local drive.
Thanks
Yes it is possible to automate it using Power Automate Desktop, you can take control of the browser, If the webpage structure remains the same and the login doesn't ask additional captcha except usual login and password fields.
You can configure the automation by
First opening the webpage using Browser Control in PAD(Power Automate Desktop)
Entering the username password can be automatically done with PAD (both should
be defined in the
automation)
Capture the web element using the action to click a button - either to
navigate the page or download something.
Can save the file into local system using PAD by usual browser download or mentioning separate path in the automation.
If you know how to code such as Python. Then Selenium,playwright,Clicknium would be a good choice. Clicknium should be the most simple one, but it can only run in Windows. In include a Recorder to identity the UI element and include APIs for click and set_text.
If you don't want to code, you can use RPA tools, such as power automate and UI path.

How to handle file download in Internet Explorer 11 using Ruby-Watir

I'm new to Ruby-Watir automation. I want to save a file, after clicking on "Download Report" link available on the web page(Opened in IE-11). It's giving me a pop-up to save the file at bottom of the browser.
enter image description here
Can anyone please help me with Ruby-Watir code to handle such popup in Internet Explorer 11? Kindly let me know if any other details required.
The simple answer is that it isn't possible with Selenium and Internet Explorer, without mucking with the registry or using AutoIT. Downloading with IE requires interaction with the operating system, which is beyond Selenium's capabilities.
Also, here's an article about why you probably actually don't need to test downloads, regardless.

Tool for capturing screenshots in TFS2010 Web Access

I need a tool to capture and attach screenshots in TFS team web access. Instead of having some thrid party tool that captures and saves images on disk and then you have to attach that image to a bug like bugshooting. I want something integrated within TFS.
In VS11 it is possible to copy and paste your screen shots in the description field of the work item. You can check out the VS11 Beta version yourself.
There's nothing integrated in VS, but there are a couple of easy options:
use the standard Windows screenshot function. Alt-PrtScrn will capture the current window, and then you can paste into your work item's Attachments pane. It'll create a generic filename and attach as a PNG.
if you're using Win7, try the "Snipping tool" (just press Start and type "snip" to find it). That will capture a specified area and can then copy it to the clipboard or save to a file. If you copy & paste you still have the problem of generic filenames, though, so personally I still tend to save it myself.
As #Hofman said, you can do it with VS 11 beta, so you can use MS Paint or even SnagIt, for how to do it just see the following link:
http://mohamedradwan.wordpress.com/2012/02/29/new-enhancement-in-mtm-11-preview/
You may want to check the Capture Custom Control - you can use it to embed a "Capture" button in your work items. It automatically attaches the screenshot to your work item.
Check it out at http://witcustomcontrols.codeplex.com/wikipage?title=Screenshot%20controls&ProjectName=witcustomcontrols
there are a very powerful tool which comes with Windows Server 2008 (Actually I'm not sure if it comes with windows 8 or 7)
never-mine.., the tool called "Record Steps To Reproduce the Problems" , this tool built for Taking screenshots of doing any thing in your machine step by step... WOW
You just need to open the start panel and then write "record steps to reproduce a problem". starting record, and make you job that you want, then when you finish stop recording and save the zip file in your machine.
the zip file will expose a word document contains every single click that you make and every page you've open with some description.

Run command on client side from browser

For our intraNET we need to run application, when user clicks on link. Security is done another way (apache, firewall). This is only for users in our company. Operation system is WindowsXP+ (some Linux).
I tried link to script file (http://intranet.domain.com/run.bat):
Chrome
can't change mimetype
browser downloads it, and after doubleclick and warning it works with .bat
Opera
with mimetypes tunning, it works with .lnk file, immediatly after click
Firefox
with mimetypes tunning, it works with .lnk file, immediatly after click
Explorer
.bat file works after warning and click on 'Run'
Safari
.bat file works after warning and click on 'Run'
It works, but with warnings and clicking. Maybe there are some other solutions (i read here) using AIR2 plugin or NPAPI plugin, but i have no experiences.
I am looking for ready to use plugin written for this purpose (commercial too). Of course we can install any application/plugin on client computer. Plugin which i can render on webpage and configure to run some command with parameters on click event (command and parameters could change on every page load, can not be compiled in plugin).
I know, there are some questions on this topic, but.. i did not find good solution. Thank you for any help.
All those warnings are there for a reason! If you could run a batch file in this way without warning this would be a huge security risk.
The best way to get this to work would be to write a signed ActiveX control that users download to their PC, install (which would require that the user confirm that they wish to install the control) and then have the ActiveX control run the batch file. This would then allow the ActiveX control to run batch files without prompting the user, however is probably way more hassle than its worth for a one-off action.

firefox open local link to directory with explorer

On a Website for our internal use i show links to local files and folders. the links are like this:
href="file://C:/example/"
href="file://C:/example/test.odt"
The Problem is now that the link to the directory does open in firefox itself with a useless directory listing. Useless because you can just see the files or open them but not copy, insert, delete...
The link to the file work normal and the file is opend by OpenOffice.
By changing the configuration of firefox and setting the following key to false I can open the directory in with explorer.exe but for the file I have to choose the right application.
network.protocol-handler.expose.file
Does someone know a way to get both to work like i want? Means that the Directory is shown by explorer.exe and all files are opened by the right application.
This can be by configuring Firefox or windows, changing the links, or even by writing a small program which opens all the file protocol correctly and will be used as protocol handler for the file protocol in firefox.
Thanks
Raffael
I did the above with small changes in Firefox 14.0.1, which works for me:
Create new boolean value network.protocol-handler.expose.file and set it to false
Create new boolean value network.protocol-handler.external.file and set it to true
Click on a link to a local folder.
In the following prompt, link to the explorer.exe in: C:\Windows\explorer.exe
Files are now open with the default application, folders are open with the Windows Explorer!
I know this is not quite what you want, but you might take a look at the "launchy" addon for firefox:
https://addons.mozilla.org/en-US/firefox/addon/81/
Using this addon you can right click on a file link, go to "launchy" sub-menu, and tell it to open in explorer. This will browse directly to the folder as you want.
I want the same feature you want, however this "works" for now. I have asked the author of launchy to allow it to override the left-click behavior for certain protocols (so it would launch explorer with one click), but I don't have a response yet.
edit: Years later, I will post the solution I started using instead of Launchy:
https://addons.mozilla.org/en-us/firefox/addon/local-filesystem-links/
https://github.com/feinstaub/firefox_addon_local_filesystem_links
This scans for file:// links and makes them clickable. It does inject some HTML which can mess with formatting if you aren't careful, but it does the job.
In about:config You need to add a boolean value with the name network.protocol-handler.expose.file and set it to false and also create a string value with the name capability.policy.default.checkloaduri.enabled and set it to allAccess.
Now you will be able to choose C:\Windows\explorer.exe to open file links.
Tested in FF 19.0.2 in Windows 7.
Try this:
Create new boolean value with the name
network.protocol-handler.expose.file and set it to false
Create new boolean value with the name
network.protocol-handler.external.file and set it to true
Open link to a local directory and on the now appearing box, register the "file"-protocol permanently with the "file"-programm (1st entry).
There should now open the windows explorer.
You can deassociate the type "file" in the Firefox-settings (applications-tab).
After that, a link to a document (i.e. file:///x:\dir\file.doc) worked automatically for me (FF8.0).
Or You can use the Plugin "Local Filesystem Links" (DE version of the page) now.
--
edit:
Link for EN version: https://addons.mozilla.org/en-US/firefox/addon/local-filesystem-links/?src=search

Resources