0

I am trying to file upload in modal form using robot/eclipse but its not working. I added autoit library to red.xml. Giving below error . Below is my code for file upload

Click Element   xpath=//*[@id="formProcessingImport"]
Win Activate  open (Explorer window)
Send   C:/Users/MyData.txt

Below is the structure and error I am getting. enter image description here enter image description here enter image description here

7
  • Please show your import statement ,
    – PDHide
    Commented Apr 26, 2020 at 9:22
  • Library AutoIt Click Element xpath=//*[@id="formProcessingImport"] Win Activate open (Explorer window) Send C:/Users/MyData.txt But now I am planning to work with Choose File locator File Path But that is also not working.
    – ADS KUL
    Commented Apr 26, 2020 at 11:23
  • I downloaded library from below address. code.google.com/archive/p/robotframework-autoitlibrary/… and now got the module error has gone but still my robot framework script is not working..
    – ADS KUL
    Commented Apr 26, 2020 at 11:27
  • THere is no setting section for your robotframework?
    – PDHide
    Commented Apr 26, 2020 at 11:53
  • In setting section only I put Library AutoIt. and as shown in image I put the path of init.py in red.xml.
    – ADS KUL
    Commented Apr 26, 2020 at 11:58

1 Answer 1

1
*** Settings ***
Documentation   This is the script for Create Sales Visit Repository
Library     AutoItLibrary    5    ${True}

*** Test Cases ***

You should pass the above arguments to the Library , timeout and takescreenshot arguments are mandatory.

use pip install robotframework-autoitlibrary to install the library.

Refer below stackoverflow discussion for more information: “No Keyword with name” error while using AutoIt Library Robot Framework.

The robotframework autoIt documentation is not much dependable, the documentation says that the library expects 3 parameters to constructor but when we check the init file we see that only 2 are required: robotframework-autoitlibrary/src/AutoItLibrary/__init__.py.

To uplaod file:

File upload in Chrome browser

control focus  [CLASS:#32770; TITLE:Open]  ${EMPTY}  [CLASSNN:Edit1]
control send  [CLASS:#32770; TITLE:Open]  ${EMPTY}  [CLASSNN:Edit1]  C:\\File_Upload\\Test_Upload
control click  [CLASS:#32770; TITLE:Open]  ${EMPTY}  &Open

File upload in Firefox browser

control focus  File Upload  ${EMPTY}  [CLASSNN:Edit1]
control send  File Upload  ${EMPTY}  [CLASSNN:Edit1]  C:\\File_Upload\\Test_Upload
control click  File Upload  ${EMPTY}  &Open

Read more documentation, the class , title etc are find using autoit finder which will be available inside the 3rdpartytools in robotframework autoit folder. But in the above code you just have to change the file name to be uploaded

enter image description here

Final Code:

*** Settings ***
Documentation   This is the script for Create Sales Visit Repository
Library     AutoItLibrary    5    ${True}

*** Test Cases ***

Input Text
    Wait For Active Window    Open
    control focus    [CLASS:#32770; TITLE:Open]    ${EMPTY}    [CLASSNN:Edit1]
    control send    [CLASS:#32770; TITLE:Open]  ${EMPTY}    [CLASSNN:Edit1]    C:\\Users\\AdsKu\\Downloads\\MyData.txt
    control click    [CLASS:#32770; TITLE:Open]  ${EMPTY}   &Open
8
  • Hello, Some progress happened. 1. I clicked my 'Upload File Here' option using Click Element xpath. File explorer opens and in the file name my files path appears. But now how to get that .txt file to nodal upload window and how to get close the file explorer.? Means how to click open button of explorer to send the file to upload.? I just use Send and my file path and not that Input text given to your example as it was giving an error,
    – ADS KUL
    Commented Apr 26, 2020 at 12:31
  • Updated the answer , ones the open window comes up use the updated code. Change test upload with file you want to upload
    – PDHide
    Commented Apr 26, 2020 at 13:08
  • Nothing is happening only window opens as is which was opening initially. Even when I just used send atleast file was displaying in the file name where I just need to click open. But the updated code of controls is not doing anything and finally my browser with upload pop up and application is getting closed.
    – ADS KUL
    Commented Apr 26, 2020 at 13:31
  • See the final code added, use that
    – PDHide
    Commented Apr 26, 2020 at 14:15
  • 1
    Finally It Done... Thanks Bro...Answer Accepted.
    – ADS KUL
    Commented Apr 26, 2020 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.