Forum Discussion
shiva_ranabhat
11 years agoContributor
:mansad:
I have tried every single combination there.Then went frustrated and post it in the community.
It is pressing Alt as you can see underline under Open.
Thanks anyway!
AlexKaras
11 years agoCommunity Hero
Hi,
The following code worked for me (to Save|Save As):
'-------------------------------------------------------------------------
Function SystemDialogFileSaveHandle(ByVal strFileFullName)
Const cProcName = "SystemDialogFileSaveHandle"
Dim cProcNameMsgPrefix : cProcNameMsgPrefix = cUnitNameMsgPrefix & cProcName & "(): "
Dim browser
Dim UploadFileWindow
Dim button, button2
Dim tmpControl
Dim FileName, FullFileName
SystemDialogFileSaveHandle = Empty
' handle notification bar window
' For cross-browser specifics:
' http://support.smartbear.com/articles/testcomplete/cross-browser-testing/
' http://smartbear.com/forums/f75/t76579/click-on-short-time-pop-window-(e-g-ie9-noti/
' http://smartbear.com/forums/f75/t60772/ie-8-file-download-box-save-button-not-gettin/
' http://smartbear.com/forums/f75/t60730/ie-8-save-button-is-visible-on-screen-but-vi/
Set browser = Aliases.browser
Select Case browser.ObjectIdentifier
Case "iexplore"
Select Case browser.FileVersionInfo.MajorPart
Case 7
Case 8
Case Else
Set UploadFileWindow = BrowserWindowByPageGet(GetPage()).FindChild("ObjectIdentifier", "Notification*", 30)
' Aliases.browser.BrowserWindow(0).Window("Frame Notification Bar", "", 1).ToolBar("Notification").Text("Notification bar Text").Value
Set button = UploadFileWindow.FindChild( _
Array("ObjectType", "ObjectIdentifier"), Array("SplitButton", "Save"), 30)
Set button2 = button.FindChild("ObjectType", "DropDownButton", 30)
button2.Click
browser.Popup("Context").MenuItem("Save as").Click
End Select
Case "firefox"
Set UploadFileWindow = browser.WaitAliasChild("MozillaDialog", 30000)
Set button = UploadFileWindow.FindChild( _
Array("ObjectType", "ObjectIdentifier"), Array("radio", "save"), 30)
button.Click
Set button = UploadFileWindow.FindChild( _
Array("ObjectType", "ObjectIdentifier"), Array("button", "OK"), 30)
Call button.WaitProperty("Enabled", True, Project.Variables.pvtPageTimeout)
button.Click
Case "chrome"
Set UploadFileWindow = browser.FindChild("WndClass", "#32770", 30)
End Select ' browser.ObjectIdentifier
FullFileName = ...
Call SystemDialogFileSave(FullFileName)
SystemDialogFileSaveHandle = FullFileName
End Function
'-------------------------------------------------------------------------
' Returns BrowserWindow object that corresponds to the given page object
' From: http://smartbear.com/forums/f75/t83264/how-to-match-a-page-object-to-its-browserwindow
Function BrowserWindowByPageGet(ByRef page)
Const cProcName = "BrowserWindowByPageGet"
Dim cProcNameMsgPrefix : cProcNameMsgPrefix = cUnitNameMsgPrefix & cProcName & "(): "
Dim title
Dim wnd
Set wnd = Utils.CreateStubObject
If (Not IsNull(page)) Then
If (0 = aqString.Compare(page.ObjectType, "Page", False)) Then
title = page.contentDocument.title
Set wnd = page.Parent.FindChild("WndCaption", title & "*")
If (Not wnd.Exists) Then
Set wnd = page.Parent.FindChild("WndCaption", Project.Variables.pvtBaseURL)
End If
End If
End If
Set BrowserWindowByPageGet = wnd
End Function
'-------------------------------------------------------------------------