Hi,
.SaveFile() method does all required actions internally and there is no need in explicit button click.
I assume that 'location' in your code sample contains only a path and you want to preserve the file name suggested by the system. When I had this case, I got the file name from the notification window displayed by the browser, combined it with the path and then just passed the obtained full file name to the SaveFile method.
This was done in the function (VBScript) that follows below. Hope it will help.
'-----------------------------------------------------------------------------
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
' Aliases.browser.BrowserWindow(0).Window("Frame Notification Bar", "", 1).ToolBar("Notification").Text("Notification bar Text").Value
FileName = ""
With Project.Variables.pvtRe
.Expression = "(?g).+ (\w+\.\w+) \(.+"
If (.Exec(UploadFileWindow.Text("Notification bar Text").Value)) Then
FileName = .Match(1)
End If
End With
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
FileName = UploadFileWindow.FindChild( _
Array("ObjectType", "ObjectIdentifier"), Array("description", "location"), 30).tooltipText
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)
FileName = UploadFileWindow.FindChild("WndClass", "Edit", 30).wText
End Select ' browser.ObjectIdentifier
FullFileName = aqFileSystem.IncludeTrailingBackSlash(Sys.OSInfo.TempDirectory) & FileName
Call SystemDialogFileSave(FullFileName)
SystemDialogFileSaveHandle = FullFileName
End Function
'-----------------------------------------------------------------------------