After a 3 day poking around I have been able to control dialogs such
as File Download and SaveAs by using the pyWinAuto, winGuiAuto,
SendKeys, Win32Gui and Win32con.
I am putting together a class file that will make this much easier to
do. I will post this once it is done or you can email me for the file.
The History for those who want to try it now:
The biggest challege was why it was clicking on the controls but
nothing was happening.
I could highlight the control and do a ClickInput on the File Download
dialog but it appears
something was missing since the Save As dialog never launched
It was a bit tricky to figure out but it is really pretty easy to do
once you have the right combination. The first part you need all the
steps but the second you may be able to cut the steps done using
pyWinAuto.
Here is a brief synopsis.
########### To click on the Save Button of the File Download Dialog
# Use PyWinAuto to perform a ClickInput()
app.FileDownload.Button2.ClickInput()
# Get a Handle to the File Download dialog using winGuiAuto.py
hwnd = winGuiAuto.findTopWindow(wantedText="File Download")
# Do a Mouse up and Mouse down (The sleep time is important)
win32gui.SendMessage(hwnd, win32con.WM_LBUTTONDOWN, 0, 0)
time.sleep(2)
win32gui.SendMessage(hwnd, win32con.WM_LBUTTONUP, 0, 0)
SendKeys.SendKeys("""{ENTER}""")
########### To click on the Save Button of the Save As Dialog
# Use PyWinAuto to perform a ClickInput()
app.SaveAs.Save.ClickInput()
# Get a Handle to the Save As dialog using winGuiAuto.py
hwnd = winGuiAuto.findTopWindow(wantedText="Save As")
# Do a Mouse up and Mouse down (The sleep time is important)
win32gui.SendMessage(hwnd, win32con.WM_LBUTTONDOWN, 0, 0)
time.sleep(2)
win32gui.SendMessage(hwnd, win32con.WM_LBUTTONUP, 0, 0)
SendKeys.SendKeys("""{ENTER}""")
Santi
2009/12/21 Calfdog <bob...@hotmail.com>:
> --
>
> 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.
>
>
>
How did you call pywinauto from Selenium? My guess is that you were
running selenium RC and had some .py scripts you called via a system
call? is this correct?
Thanks,
Ivan.-
On 21 dic 2009, 22:54, Calfdog <bobm...@hotmail.com> wrote:
> I noticed that dialog control was non existent for IE.
> So I took it it on to see if I can get it working.
>
> After a 3 day poking around I have been able to control dialogs such
> as File Download and SaveAs by using thepyWinAuto, winGuiAuto,
> SendKeys, Win32Gui and Win32con.
>
> I am putting together a class file that will make this much easier to
> do. I will post this once it is done or you can email me for the file.
>
> The History for those who want to try it now:
>
> The biggest challege was why it was clicking on the controls but
> nothing was happening.
> I could highlight the control and do a ClickInput on the File Download
> dialog but it appears
> something was missing since the Save As dialog never launched
>
> It was a bit tricky to figure out but it is really pretty easy to do
> once you have the right combination. The first part you need all the
> steps but the second you may be able to cut the steps done usingpyWinAuto.
>
> Here is a brief synopsis.
>
> ########### To click on the Save Button of the File Download Dialog
>
> # UsePyWinAutoto perform a ClickInput()
> app.FileDownload.Button2.ClickInput()
>
> # Get a Handle to the File Download dialog using winGuiAuto.py
> hwnd = winGuiAuto.findTopWindow(wantedText="File Download")
>
> # Do a Mouse up and Mouse down (The sleep time is important)
> win32gui.SendMessage(hwnd, win32con.WM_LBUTTONDOWN, 0, 0)
> time.sleep(2)
> win32gui.SendMessage(hwnd, win32con.WM_LBUTTONUP, 0, 0)
>
> SendKeys.SendKeys("""{ENTER}""")
>
> ########### To click on the Save Button of the Save As Dialog
>
> # UsePyWinAutoto perform a ClickInput()