-2

How do I accept windows popup of Mozila firefox to save or open a file in ROBOT FRAMEWORK ?

Sidara KEO
  • 1,693
  • 1
  • 14
  • 34
Mandar Bhale
  • 11
  • 1
  • 3
  • 3
    Possible duplicate of [Click on Save button on File Download popup in IE11 in robot framework](https://stackoverflow.com/questions/38298162/click-on-save-button-on-file-download-popup-in-ie11-in-robot-framework) – Nordle Oct 04 '18 at 06:08
  • Could you describe what's type of popup ? – Sidara KEO Oct 04 '18 at 06:26
  • Mozilla firefox popup asking either to open or save file...I have tried setting default preferences but it seems each automation instance starts fresh firefox window with default(old) preferences.. – Mandar Bhale Oct 04 '18 at 06:41
  • @MandarBhale did you try this https://stackoverflow.com/questions/45995869/handling-mozilla-firefox-download-box-through-robot-framework-using-selenium2lib ? – Sidara KEO Oct 04 '18 at 07:22
  • Yes I have tried it – Mandar Bhale Oct 04 '18 at 12:01
  • 1
    Possible duplicate of [Handling mozilla firefox download box through robot framework using Selenium2Library](https://stackoverflow.com/questions/45995869/handling-mozilla-firefox-download-box-through-robot-framework-using-selenium2lib) – A. Kootstra Oct 05 '18 at 05:38
  • @A.Kootstra Does this work for you ? – Sidara KEO Oct 05 '18 at 06:09
  • I have not tried python library...i am currently trying autoit v3 but it is unable to capture the controllerID for open button in the prompt – Mandar Bhale Oct 05 '18 at 06:26

2 Answers2

1

I think this just a tempoary solution for you to sovle your current problems . So you just create own custom keywoard like below by using library python pynput .

from pynput.keyboard import Key, Controller
    keyboard = Controller()
    # Press and release key
    def acceptDownloadff():
        keyboard.press(Key.down)
        keyboard.release(Key.down)
        keyboard.press(Key.enter)
        keyboard.release(Key.enter)

and here is a sample robotframework just call this keyword from your python file :

*** Settings ***
Library    Selenium2Library
Library    test.py
*** Variables ***
${url}                yoururl
*** Test Cases ***
Make Something
    open browser            ${url}      ff  
    Click Element        id=dl
    acceptDownloadff

i'm already tested it . and it's work and can solve your problem if you are unable to find other solution.

Sidara KEO
  • 1,693
  • 1
  • 14
  • 34
  • But this would require some kind of ID...The problem is the element which I want to click is not on the webpage but firefox download prompt which is external to the webpage I am automating... – Mandar Bhale Oct 05 '18 at 06:29
  • i'm still blur with your question. if possible you should add more information attach with your question more it's can make everybody can understand and help you – Sidara KEO Oct 05 '18 at 06:31
  • @MandarBhale My answer is not focus on ID or click element it's about to handle pop up of firefox – Sidara KEO Oct 05 '18 at 06:35
  • I think there is some issue with this solution..https://stackoverflow.com/questions/45995869/handling-mozilla-firefox-download-box-through-robot-framework-using-selenium2lib I cannot find where the writtem library is used...Shouldnt there be a function call? – Mandar Bhale Oct 05 '18 at 06:55
  • @MandarBhale Did you know how to write custom library in robotframework ? – Sidara KEO Oct 05 '18 at 07:20
  • Not exactly but I have written a .py file containing the code and tried acessing it using the function name as keyword.. – Mandar Bhale Oct 05 '18 at 07:49
  • @Sdara KEO I have written a .py file containing the code and tried accessing it by using function name as keyword...But i dont know exact way to do it.. – Mandar Bhale Oct 05 '18 at 07:52
  • Yes sure , Just call your function name into robotframework . and don't forget to import your py file by using : Library test.py . you can look at my answer i have import file test.py into robotframework – Sidara KEO Oct 05 '18 at 09:00
0

You can use the AutoIt Library to handle with this kind of windows, please verify with the autoit window info to put the right IDs if dont work the example below

For Download:
    Slee    1
    Win Activate    Save Image
    Control Set Text    Save Image    \    Edit1    c:\fileSaved.jpg
    Control Click    Save Image    \    Button2

For Upload:
    Sleep    1
    Win Activate    File Upload
    Control Set Text    File Upload    \    Edit1    c:\fileUploaded.jpg
    Control Click    File Upload    \    Button1

After install the autoit library you can access the keywords definitions on:
file:///C:/RobotFramework/Extensions/AutoItLibrary/AutoItLibrary.html

HD Fanatic
  • 23
  • 5