Showing posts with label autoit. Show all posts
Showing posts with label autoit. Show all posts

Tuesday, January 17, 2012

Auto it basics for entering text

Press escape key : Send("{ESCAPE}")
Press enter key : Send("{ENTER}")
Press tab key : Send("{TAB}")

Enter some content and press tab key : Send("water{TAB}")
Enter some content and press enter key : Send("water{ENTER}")

Autoit for File upload

Firefox

WinWaitActive("File Upload")
if WinExists("File Upload") Then
ControlSetText("File Upload", "", "Edit1", "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg")
Sleep(1000)
ControlClick("File Upload", "", "Button2")
EndIf

IE

WinWaitActive("Choose file")
if WinExists("Choose file") Then
ControlSetText("Choose file", "", "Edit1", "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg")
Sleep(1000)
ControlClick("Choose file" ,"", "Button2")
EndIf

Chrome

WinWaitActive("Open")
if WinExists("Open") Then
ControlSetText("Open", "", "Edit1", "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg")
Sleep(2000)
ControlClick("Open", "", "Button2")
EndIf

For more reference follow these links. These guys have given nice example
http://qtp-help.blogspot.com/2009/07/selenium-handle-dialogs.html
http://automationtricks.blogspot.com/2010/09/how-to-upload-file-in-selenium-with.html
http://iautomateit.wordpress.com/2011/07/15/working-around-file-upload-dialog-issues-with-selenium-2/
http://bharath-marrivada.blogspot.com/2011/02/selenium-autoitv3-file-upload-download.html