How to Upload file from windows directory using selenium2library and Robot Framework

Auto-learner picture Auto-learner · May 12, 2016 · Viewed 8k times · Source

Can someone help me How to Upload file from windows directory using selenium2library and Robot Framework.I have tried using Choose File command in selenium2library but I am getting error as File doesn't exist in local file system.I am not sure whether directory path is not considered or any other issue. Please give me valid code or any alternate solution.Any help would be appreciated.Following is the command I have tried

Choose file     xpath = //input[@firmware-upgrade='firmware']       /Downloads/Cambium_Builds/Falcon/ePMP1000-Hotspot-2.5.1-b3.tar

HTML tag is `

Image location and HTML tag`

Answer

Auto-learner picture Auto-learner · May 13, 2016

Thanks every one for your answers and time,but luckily following script helped my uploading a file from windows and its working fine.There might be different options to perform the same using AutoIT but I have tried with whatever i know.

***Settings***
Library  Selenium2Library


*** Variables ***
${Browser_Chrome}           Chrome
${Device_77_URL}        https://10.110.0.17
${Device_Path}          C:\\Users\\mra001\\Downloads\\Builds\\Gambit\\500-2.5.1-b3.img

*** Keywords ***


Software Update 
    Open Browser    ${Device_77_URL}    Chrome
    Input Text      id=Username  admin
    Input Text      password=Password    admin
    Click Button    xpath = //button[@type='submit']
    Wait Until Element Is Visible       //a[text()='Home']      20
    Click Link      xpath = //a[text()='Operations ']
    Input Text  xpath = //input[@firmware-upgrade='firmware']  ${Device_Path}
    Click Button        Upgrade Firmware
    Sleep       70
    Confirm Action
    Close Browser