SELENIUM BASICS:

  • What is Automation Testing - Advantages & Types of Tools
  • What is Selenium IDE, Selenium RC, Selenium WebDriver, Selenium Grid?
  • Selenium IDE, Firebug & Firepath Installation

  • SELENIUM WEBDRIVER:

  • Selenium WebDriver Architecture
  • Selenium Installation
  • Challenges and Limitations of Selenium
  • First Selenium WebDriver Script
  • Working with Firefox Browser
  • Solution - Failed To Launch Browser Using Selenium WebDriver
  • Working with Chrome Browser
  • Working with IE Browser
  • Difference Between FindElement & FindElements
  • Install Firebug, Fire path and other add on for Selenium
  • Locators in Selenium
  • Dynamic Xpath
  • Dynamic CSS
  • Handle drop-downs
  • How to work with file upload
  • Handle Alerts & Popups
  • Handle Multiple Windows
  • Mouse Hover event in Selenium
  • Right Click
  • Double Click
  • Drag and Drop
  • Capture Screenshots in Selenium
  • Parameterization
  • Synchronization
  • Implicit Wait, Explicit Wait and Fluent Wait in Selenium
  • Implicit Waits
  • Explicit WebDriver Waits
  • Fluent Wait In Selenium
  • Apache POI
  • How To Read Data From Excel File
  • How To Write Data In Excel File
  • Database Testing Using MSSQL
  • Database Testing Using MySQL
  • Database Testing Using DB2
  • Handle Ajax Call in Selenium
  • Listeners in Selenium
  • Handling JavaScript in Selenium
  • Stale Element Reference Exception in Selenium
  • Integrate Sikuli with Selenium
  • Headless Browser Testing 
  • Headless Browser Testing using HtmlUnitDriver
  • Headless Browser Testing using PhanthomJSDriver

  • TESTNG:

  • TestNG Installation
  • TestNG Complete Tutorial

  • REPORTS:

  • Extent Reports Introduction
  • Extent Reports Generation
  • Capturing Screenshots & Including In Extent Reports
  • Extent Reports Version 4

  • BUILD & CONTINUOUS INTEGRATION TOOLS:

  • ANT Build Tool - How To Download & Install
  • Maven Build Tool - How To Download & Install
  • Creating Maven Selenium Project
  • GIT Integration with Selenium
  • Jenkins - How To Download & Install
  • Jenkins - Executing TestNG Scripts
  • Jenkins - Generating Reports After Test Execution
  • Jenkins - Executing Maven Project
  • Create build and Execute build for nightly execution
  • Send Email report based on build Status
  • Selenium Continuous Integration with Jenkins [Selenium – Maven – Git – Jenkins] – Step By Step Guide

  • CROSS BROWSER TESTING:

  • Running Selenium Tests On BrowserStack
  • Kobiton - Mobile Testing Platform with Real Devices

  • MOBILE TESTING:

  • Mobile Testing Platform with Real Devices

  • AUTOMATION FRAMEWORKS:

  • What is Framework & Types of Framework
  • Page Object Model Design Pattern
  • Data Driven Framework
  • How to explain Test Automation Framework or Selenium Automation Framework Architecture In Interview

  • API Testing:

  • Learn API Testing
  • Postman Tutorial (API Testing with Postman)

  • INTERVIEW QUESTIONS:

  • Test Automation Framework Interview Questions
  • Selenium Interview Questions
  • TestNG Interview Questions
  • Java Interview Questions
  • Python Interview Questions
  • API Testing Interview Questions

  • SAMPLE RESUME:

  • Automation Tester Resume
  • How To Upload File Using AutoIT And SendKeys In Selenium WebDriver

    Upload File using AutoIT & SendKeys:

    In this post we are going to see on how to upload file using AutoIT and sendKeys method in Selenium WebDriver. There are two cases which are majorly used to upload file in Selenium WebDriver such as using SendKeys Method and using AutoIT Script.

    Also Read: How To Download File Using AutoIT in Selenium WebDriver

    1. Upload file using SendKeys method in Selenium WebDriver:

    Its very straightforward. Using sendkeys method, we could easily achieve this. Locate the text box and set the file path using sendkeys and click on submit button.

    2. Upload file AutoIt Script in Selenium WebDriver:

    If there is no text box to set the file path and only able to click on Browse button to upload the file in the windows popup box then we do upload file using AutoIt tool.

    AutoIt Introduction:

    AutoIt Tool is an open source tool. It is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!

    Now the question is how we do upload file using AutoIT Tool in Selenium WebDriver.

    Follow the below steps:

    1. Download Autoit tool from here and install it
    2. Open Programs – Autoit tool – SciTE Script Editor and add the below mentioned AutoIt script in Autoit editor and save it as ‘UploadFile.au3’ in your system
    3. Convert it as ‘UploadFile.exe’
    4. In Eclipse, add the below mentioned Selenium Script and run

    Step 1: Download AutoIt tool and install

    Step 2: Open SciTE Script editor and add the below mentioned AutoIt script and save it as ‘UploadFile.au3’ in your system.

    AutoIt Script:

    AutoIt Script Explanation:

    Line 1 : WinWaitActive(“File Upload”)

    Above line of code changes the focus of cursor on the Window popup box to upload file.

    File Upload‘ is the name of the window popup when using Mozilla Firefox. If you want to use other browsers such as Chrome you need to pass the value as ‘Open‘ (‘Open’ is the name of the window popup) and for IE you need to pass the value as ‘File To Upload’ (‘File To Upload’ is the name of the window popup)

    Line 2 : Send(“Path of the document”)

    Once the window popup is active, it sets the path of the document which needs to be uploaded

    Send(“D:\SoftwareTestingMaterial\UploadFile.txt”)

    Line 3 : Send(“{ENTER}”)

    After that it clicks on Open button which will upload the document

    Step 3: Once the file is saved, we need to convert the ‘UploadFile.au3’ to ‘UploadFile.exe’. To do this we need to compile the ‘UploadFile.au3’

    UploadFile Compile Autoit

    Right click on the file ‘UploadFile.au3’ and click on ‘Compile Script’ to generate an executable file ‘UploadFile.exe’

    Step 4: In Eclipse, add the below mentioned Selenium Script and run

    Given clear explanation in the comments section with in the program itself. Please go through it to understand the flow.

    In the above Selenium Script, we did call the AutoIt Script after clicking on the browser button which transfers windows popup box and upload the required file.

    Syntax:

    Runtime.getRuntime().exec(“D:\\SoftwareTestingMaterial\\AutoIt\\Uploadfile.exe”);

    This way we could upload a file using AutoIT

    If you are not regular reader of my blog then I highly recommend you to signup for the free email newsletter using the below link.

    Upload file using AutoIT

    Get our latest blog posts delivered to your inbox

    Subscribe and get popular blog posts about software testing industry.

    Rajkumar

    3 thoughts on “How To Upload File Using AutoIT And SendKeys In Selenium WebDriver”

    1. Hi Team,

      Are you guys aware if there is any solution for MS Edge browser Upload file feature specially with AutoIT.
      When I try to run/compile it manually then it works fine but whenevr we try to execute it using selenium then it doesn;t work.

      Is there any other way out to upload file on Edge browser (.sendkeys wont be of use for me.)

      AutoIT script which works for manual run (Reference) :

      ControlFocus(“Open”,””,”Edit1″)
      Sleep(1000)
      WinSetState(“Open”, “”, @SW_MAXIMIZE)
      Sleep(1000)
      ControlSetText(“Open”,””,”Edit1″,’C:\Users\nilasing\Downloads\somefilename’)
      Sleep(1000)
      ControlClick(“Open”,””,”Button1″)

      Please help

    2. Is there any draw backs for using AutoIt while executing in Jenkins in some remote machines

      • Hi Murali, I never faced any issues. If you have issue, user Robot Class

    Leave a Comment

    Share via
    Copy link
    Powered by Social Snap