2

My compiled AutoIt script automates OS windows like "upload file selection window". For Google Chrome it works. But using InternetExplorerDriver it does not send the file path to the OS window.

Below is the code. I am running testng.xml to trigger the browser.

import io.github.bonigarcia.wdm.ChromeDriverManager;
import io.github.bonigarcia.wdm.InternetExplorerDriverManager;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import pom.LoginPom;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * Created by User on 28/5/2017.
 */
public class MyTest1 extends Tests{

    private WebDriver driver;
    @BeforeTest
    @Parameters("Browser")
    public void setup(String browser){

        if (browser.equals("ie")) {
            InternetExplorerDriverManager.getInstance().arch32().setup();
            driver = new InternetExplorerDriver();
        }
        else if (browser.equals("chrome")){
            ChromeDriverManager.getInstance().arch32().setup();
            driver = new ChromeDriver();
        }
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
        driver.manage().timeouts().pageLoadTimeout(5,TimeUnit.SECONDS);
        driver.navigate().to("http://aspuploader.com/demo/form-singlefile.asp");
    }

    @Test
    public void test1() throws InterruptedException, IOException {
        WebElement elem = driver.findElement(By.id("myuploaderButton"));//.click();
        JavascriptExecutor ja = (JavascriptExecutor) driver;
        ja.executeScript("arguments[0].click();", elem);
        Thread.sleep(3000);
        Runtime.getRuntime().exec("src/test/java/script.exe");
    }

    @AfterMethod
    public void close(){
        driver.close();
    }

}
`

AutoIt script:

WinWait("Open", "", 3000)
ControlFocus("Open", "", "Edit1")
ControlSetText("Open", "", "Edit1", "Hello")
ControlClick("Open", "", "Button1")
user4157124
  • 2,809
  • 13
  • 27
  • 42
Javed Ahmed
  • 223
  • 1
  • 3
  • 17
  • Following is simple autoit script `WinWait("Open","",3000) ControlFocus("Open","","Edit1") ControlSetText("Open","","Edit1","Hello") ControlClick("Open","","Button1")` – Javed Ahmed May 29 '17 at 15:52

1 Answers1

0

Some times for different browsers the tittle and the text changes w.r.t to autoIT. It might happen that the tittle that you are searching for in chrome is not available for internet explorer. I suggest to re-check the tittle and text for internet explorer.

Alok
  • 1,441
  • 4
  • 20
  • 31