Katalon Analytics (beta) – Bringing new insights into test reports. Learn more!

How to Upload a file from windows explorer


in my  project , i can able to click on a button to upload after that i cannot able to select a a file from the windows explorer path to upload. please help me with an example


  • Please use 'Upload File' keyword. Example is within that page.
  • Actually this didnt work. Moreover it does not have an image to understand how this works.

    Once the attachment button is clicked it navigates to windows explorer to choose the file but we are not sure how to go after that.

    whether we need to find any other way or any integartion is required like auto it to support this upload feature?
  • That keyword will:
    1. Click on 'Upload' button on the web application
    2. Select the file based on the input path to that keyword.
    That's all for how of this keyword behaves.

    Can you please tell me more about why it didn't work from your side after you've tried it?
  • The UploadFile keyword only works if your field is <input type="file">. Please check again. If it isn't, please use this keyword.

    import java.awt.Robot
    import java.awt.Toolkit
    import java.awt.datatransfer.StringSelection
    import java.awt.event.KeyEvent

    import com.kms.katalon.core.testobject.TestObject
    import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

    def uploadFile(TestObject to, String filePath) {


    StringSelection ss = new StringSelection(filePath);
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);

    Robot robot = new Robot();
  • Use this below code:Simple just load the upload object with the file which you placed in the local system.
    Like load the object with you local file path.
    WebUI.uploadFile(findTestObject('ASACoverObjs/ChooseDocFileBtnObj'), "F:\\AutomationProjects\\BeautyBookingWebSite\\BeautyBookingWebsiteAutomationProject21042017\\Data Files\\TestDataFiles\\Test Data Doc file.docx")
Sign In or Register to comment.