Download AutoIT
1. HellWorld first AutoIt Script:
2. Simple Notepad AutoIt Script:
3. File Uploading using AutoIT Script:
4. File Uploading using AutoIT Java Code:
1. HellWorld first AutoIt Script:
#include <MsgBoxConstants.au3> MsgBox($MB_OK, "Tutorial", "Hello World!")
2. Simple Notepad AutoIt Script:
Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text.") WinClose("Untitled - Notepad") WinWaitActive("Notepad", "Save") ;WinWaitActive("Notepad", "Do you want to save") ; When running under Windows XP Send("!n")
3. File Uploading using AutoIT Script:
WinWaitActive("File Upload") ControlSetText("File Upload", "", "Edit1", "C:\Users\SIDHARTH\Desktop\Simple.txt") ControlClick("File Upload", "&Open", "Button1")
4. File Uploading using AutoIT Java Code:
package org.autoit.test; import java.io.IOException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class AutoITFileUploading { @Test public void fileUploading() { try { System.setProperty("webdriver.gecko.driver", "J:/Softwares/App/geckodriver.exe"); WebDriver driver = new FirefoxDriver(); driver.manage().window().maximize(); driver.get("http://anish-selenium.blogspot.in/p/fil.html"); driver.findElement(By.id("myFile")).click(); Thread.sleep(4000); Runtime.getRuntime().exec("J:/Softwares/AutoIt/File Uploading AutoIt Script.exe"); } catch (IOException | InterruptedException e) { e.printStackTrace(); } } }
You won't believe me, but I was planning to write a blog very similar to the one you have posted here. Great work!
ReplyDeleteSelenium Training In Chennai
Java Training In Chennai