Monday, 7 April 2014

Handle Download popup using Firefox Browser Profile


Note|  Text in Blue [#PYTHON] and Orange [#JAVA] can be edited or mentioned important for the entire blog. All the posts are practically done by me.


Firefox Browser Profile [Download Files]

This is the continuation of my previous topics, #link1 and #link2.  The simplest way to ignore Browser pop-up and save files is to make use of Browser profiles;  There are couple of ways to do this [can be done either manually or using scripts]

Advantages of using Browser Profile
    1| Skip download pop-up and save the files on specific folder
    2| No need of 3rd party tools like AutoIT or Java Robot



#Method1

Before you start working with pop-ups on Browser profiles, make sure that the Download options are set default to Save File.

(Open Firefox) Tools > Options > Applications





#Method2


Make use of the below snippet and do edits whenever necessary.


FirefoxProfile profile = new FirefoxProfile();

String path = "C:\\Test\\";
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.dir", path);
profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/msword, application/csv, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream");
profile.setPreference("browser.download.manager.showWhenStarting", false);
profile.setPreference("browser.download.manager.focusWhenStarting", false);  
profile.setPreference("browser.download.useDownloadDir", true);
profile.setPreference("browser.helperApps.alwaysAsk.force", false);
profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
profile.setPreference("browser.download.manager.closeWhenDone", true);
profile.setPreference("browser.download.manager.showAlertOnComplete", false);
profile.setPreference("browser.download.manager.useWindow", false);
profile.setPreference("services.sync.prefs.sync.browser.download.manager.showWhenStarting", false);
profile.setPreference("pdfjs.disabled", true);
       
driver = new FirefoxDriver(profile);

13 comments:

  1. It was very nice article and it is very useful to Selenium learners.We also provide Cub training software online training.

    ReplyDelete
    Replies
    1. Seleniumworks: Handle Popup Using Firefox Browser Profile >>>>> Download Now

      >>>>> Download Full

      Seleniumworks: Handle Popup Using Firefox Browser Profile >>>>> Download LINK

      >>>>> Download Now

      Seleniumworks: Handle Popup Using Firefox Browser Profile >>>>> Download Full

      >>>>> Download LINK M2

      Delete
  2. My download pop up displays radio buttons open File and save File need to select save File and press enter. Please help me understand how to handle this.

    ReplyDelete
    Replies
    1. You can use the tab like, robot.keyPress(keyEvent.vk_TAB). First we need to check the pop-up manually using tab press or enter etc. so that we will come to know about its behavior. Then try to use the above piece of code. It will work. But you need to check how many time you need to tabs and where to hit the enter.

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. In my download popup there is no option for Tab on 'Save' link to download the file. Please Suggest how I can Proceed further.

    ReplyDelete
  5. Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.

    Online Robot Framework Training

    ReplyDelete
  6. Wow this is really amazing post. Thanks for sharing the useful informative data. I appreciate your difficulty work. Keep blogging. Protractor Training in Electronic City

    ReplyDelete
  7. Compre documentos en línea, documentos originales y registrados.
    Acerca de Permisodeespana, algunos dicen que somos los solucionadores de problemas, mientras que otros se refieren a nosotros como vendedores de soluciones. Contamos con cientos de clientes satisfechos a nivel mundial. Hacemos documentos falsos autorizados y aprobados como Permiso de Residencia Español, DNI, Pasaporte Español y Licencia de Conducir Española. Somos los fabricantes y proveedores de primer nivel de estos documentos, reconocidos a nivel mundial.

    Comprar permiso de residencia,
    permiso de residenciareal y falso en línea,
    Compre licencia de conducir en línea,
    Compre una licencia de conducir española falsa en línea,
    Comprar tarjeta de identificación,
    Licencia de conducir real y falsa,
    Compre pasaporte real en línea,

    Visit Here fpr more information. :- https://permisodeespana.com/licencia-de-conducir-espanola/
    Address: 56 Guild Street, London, EC4A 3WU (UK)
    Email: contact@permisodeespana.com
    WhatsApp: +443455280186

    ReplyDelete
  8. Plumbing & HVAC Services San Diego
    Air Star Heating guarantees reliability and quality for all equipment and services
    Air Star Heating is specializing in providing top-quality heating, ventilating, air conditioning, and plumbing services to our customers and clients.
    Our company is leading the market right now. By using our seamless and huge array of services. Our customers can now have the privilege of taking benefit from our services very easily and swiftly. To cope up with the desires and needs of our clients we have built an excellent reputation. We are already having a huge list of satisfied customers that seem to be very pleased with our services.

    Plumbing & HVAC Services in San Diego. Call now (858) 900-9977 ✓Licensed & Insured ✓Certified Experts ✓Same Day Appointment ✓Original Parts Only ✓Warranty On Every Job.
    Visit:- https://airstarheating.com

    ReplyDelete
  9. Seleniumworks: Handle Popup Using Firefox Browser Profile >>>>> Download Now

    >>>>> Download Full

    Seleniumworks: Handle Popup Using Firefox Browser Profile >>>>> Download LINK

    >>>>> Download Now

    Seleniumworks: Handle Popup Using Firefox Browser Profile >>>>> Download Full

    >>>>> Download LINK 6B

    ReplyDelete