1

I'm trying to upload a file using Selenium on Windows 7 using AutoIt following this tutorial http://www.toolsqa.com/selenium-webdriver/autoit-selenium-webdriver/.

The web page I'm using is this one http://www.toolsqa.com/automation-practice-form/ (click on Choose File button).

Here is my Java code

package practiceTestCases;

import java.io.IOException;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class AutoIt_00 {

private static WebDriver driver = null;

public static void main(String[] args) throws IOException, InterruptedException {

    driver = new FirefoxDriver();

    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    driver.get("http://www.toolsqa.com/automation-practice-form");

    driver.findElement(By.id("photo")).click();

    Runtime.getRuntime().exec("C:/Users/xxx/Desktop/testAutoIt_03.exe");

    Thread.sleep(5000);

    //driver.close();

   }

}

and this is the AutoIt code

#region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00000410)  ---
WinWaitActive("C:\Users\520\Desktop\testAutoIt_03.au3 - SciTE","")
Send("{TAB}")
WinWaitActive("C:\Users\520\Desktop\testAutoIt_03.au3 * SciTE","")
Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}")
WinWaitActive("Caricamento file","")
MouseClick("left",242,415,1)
Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{UP}{UP}{UP}{ENTER}")
#endregion --- Au3Recorder generated code End ---

I've tried to move in the window where select my file using keyboard and not the mouse hoping to simplify my job.

When execute the Java code it works, connect to the web site, open the window for the file choice, but after this nothing happens.

Any suggestions?

3

0