Not able to click on 'save' button (AutoIt)

2,772 views
Skip to first unread message

entitle direct

unread,
Oct 11, 2010, 3:38:52 AM10/11/10
to seleniu...@googlegroups.com
Hi,
   Iam using selenium RC with java, to handle windows elements Iam using AutoIt.
Following is the my autoIt script:
 
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("This is some textjknjjk.")
$MyDocsFolder = "C:\Automation"
FileSaveDialog( "Save As", $MyDocsFolder,"Text Documents (*.txt)","","abc")
ControlClick("Save As","","Button2")
 
 
Here it is not clicking on save button,except that everything is working fine.
 
Can any one plz help

santhosh soma

unread,
Oct 11, 2010, 3:41:28 AM10/11/10
to seleniu...@googlegroups.com

Can you please try with the following code.hope it works

Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("This is some textjknjjk.")
$MyDocsFolder = "C:\Automation"
ControlClick("Save As","","Button2")
FileSaveDialog( "Save As", $MyDocsFolder,"Text Documents (*.txt)","","abc")

Thanks
Santhosh


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Niraj Kumar

unread,
Oct 11, 2010, 3:42:52 AM10/11/10
to seleniu...@googlegroups.com
WinActivate("Save As")
Local $file = "C:\Documents and Settings\nirkumar\Desktop\Anup.doc"
ControlSetText("Save As", "", "Edit1", $file )

ControlClick("Save As", "", "Button2")


On Mon, Oct 11, 2010 at 1:08 PM, entitle direct <edte...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.



--
Thanks & Regard,
Niraj Kumar

entitle direct

unread,
Oct 11, 2010, 5:44:47 AM10/11/10
to seleniu...@googlegroups.com
Hi Niraj,
Thanks for the help.
Still not working.I think problem is with 'control click' method.

Niraj Kumar

unread,
Oct 11, 2010, 5:46:55 AM10/11/10
to seleniu...@googlegroups.com
control click . Can you tell me exact scenario and what browser you are using?

entitle direct

unread,
Oct 11, 2010, 6:00:28 AM10/11/10
to seleniu...@googlegroups.com
My task is when I click on 'generate report' button pdf file will be generated.I want to save this file in my local system, so for saving that file Iam using autoIt.
I tried this in firefox and IE but no result.

Niraj Kumar

unread,
Oct 11, 2010, 6:52:54 AM10/11/10
to seleniu...@googlegroups.com
the script i sent you will work only to save the file if dialog box opens.

in selenium you have to reach the point where it opens the save dialog box .
then change the file name and path of pdf in autoIT script what i sent you and make it exe and call them from selenium.

entitle direct

unread,
Oct 11, 2010, 7:54:16 AM10/11/10
to seleniu...@googlegroups.com
When clicked on 'Generate Document' button, pdf file will be opened in a web page(it won't open save dialog box).So in order to save that file I used following AutoIt code,
 
$MyDocsFolder = "C:\Automation"
FileSaveDialog( "Save As", $MyDocsFolder,"Adobe PDF Files (*.pdf)",2,"abcd")
WinActivate("Save As")

ControlClick("Save As","","Button2")
 
When above code is executed,Save As dialog box is opened, destination folder is selected , file name is typed,file type is selected and stopped.
It is not clicking on save button :(

entitle direct

unread,
Oct 12, 2010, 2:39:40 AM10/12/10
to seleniu...@googlegroups.com
Hi Niraj,
   I used the following code to upload a file in IE,

#include <IE.au3>
; Internet Explorer is partly integrated in shell.application
$oShell = ObjCreate("shell.application") ; Get the Windows Shell Object
$oShellWindows=$oShell.windows   ; Get the collection of open shell Windows
$MyIExplorer=""
for $Window in $oShellWindows    ; Count all existing shell windows
  ; Note: Internet Explorer appends a slash to the URL in it's window name
  if StringInStr($Window.LocationURL,"http://") then
      $MyIExplorer=$Window
      exitloop
  endif
next
$oForm = _IEGetObjByName ($MyIExplorer, "UploadedFile")
_IEAction($oForm, "click")
WinActivate("Choose file");
Local $file = "D:\IMP\test.pdf"
ControlSetText("Choose file", "", "Edit1", $file )
ControlClick("Choose file", "", "Button2")


But it is  just selected  the 'choose file' window,browses the path(D:\IMP\) and stopped.

Can you please tell me whats wrong here.
Reply all
Reply to author
Forward
0 new messages