Hi William,
Excuse me for the delayed reply...
> Anytime arrived sooner than expected.
:) (Y)
Not sure if I got the whole question and the problem... Please let me know if this is the case.
Meanwhile, here is the core of the code that works for me (web application, upload of some file). I left a workaround code in the SystemDialogFileOpen() function as a sample. In my given case, some links that initiate file upload were overlapped by the invisible unrelated objects, so TestComplete reported the 'overlapping window' warning and the upload process was not started. The workaround solved this (the warning in the log is still there, so as a side benefit, I can find places where links are overlapped) and made it possible to keep the test code to be generic (more or less).
The "dlgInternetExplorer" alias item is a child of the browser and is mapped using this condition:
WndClass Equals #32770 And WndCaption Does Not Equal "View Downloads*" And Visible Equals True
...
arFilesToUpload = Array("ItemNameFromStores")
Set oAddLink = LinkGet(oPanel.Parent, "#", "")
Call Log.AppendFolder(aqString.Format("Upload files using the %s panel:", _
aqString.Quote(cPanelCaption)), oPanel.FullName)
For Each strFileToUpload In arFilesToUpload
If (Not Files.Contains(strFileToUpload)) Then
Call Log.Warning( _
aqString.Format("%sExpected %s item was not found in the Files collection", _
cProcNameMsgPrefix, aqString.Quote(strFileToUpload)), strFileToUpload)
Else
Call LinkClick(oAddLink, "")
strFile = Files.FileNameByName(strFileToUpload)
Call SystemDialogFileOpen(strFile)
Call WaitPageLoaded(oPanel, "", "", "", "") ' to wait for potentially long file upload
...
'-----------------------------------------------------------------------------
Function SystemDialogFileOpen(ByVal strValue)
Const cProcName = "SystemDialogFileOpen"
Dim cProcNameMsgPrefix : cProcNameMsgPrefix = cUnitNameMsgPrefix & cProcName & "(): "
Dim page
Dim browser
Dim dlgChooseFile
Dim strNewValue
Dim oMsgWin
Set page = GetPage()
Set browser = Aliases.browser
Set dlgChooseFile = browser.WaitAliasChild("dlgInternetExplorer", 1000)
' The last resort to find a dialog
If (Not dlgChooseFile.Exists) Then
' Workaround for the overlapping Flash object problem
Dim d
Set d = Sys.Desktop
Call d.MouseDown(Win32API.VK_LBUTTON, d.MouseX, d.MouseY)
Call aqUtils.Delay(500)
Call d.MouseUp(Win32API.VK_LBUTTON, d.MouseX, d.MouseY)
Set dlgChooseFile = browser.WaitAliasChild("dlgInternetExplorer", 10000)
If (Not dlgChooseFile.Exists) Then
' DONE: Safari workaround
If ("safari" = browser.ObjectIdentifier) Then
Set dlgChooseFile = browser
Else
Set dlgChooseFile = page.Parent
End If
dlgChooseFile.Refresh
Set dlgChooseFile = dlgChooseFile.WaitWindow("#32770", "*", -1, Project.Variables.pvtPageTimeout)
End If
End If
' Workaround for IE9 issue when access to the UNC file is denied whatever
' login credentials are entered
strNewValue = ""
If ("iexplore" = browser.ObjectIdentifier) Then
If (9 = browser.FileVersionInfo.MajorPart) Then
strNewValue = FileNameMakeUnique(strValue)
strValue = strNewValue
End If
End If
Call Log.Message(aqString.Format("Select the %s file in the ensuing Open File dialog window", _
aqString.Quote(strValue)), _
strValue)
If (Not dlgChooseFile.Exists) Then
Call Log.Error("Open File dialog window was not found. File was not processed.", _
strValue, , , page.PagePicture)
SystemDialogFileOpen = ""
Exit Function
End If
Call dlgChooseFile.OpenFile(strValue)
Set oMsgWin = page.WaitAlert(500)
If (oMsgWin.Exists) Then
Call Log.Warning(aqString.Format("%s error was shown while processing %s file", _
aqString.Quote(oMsgWin.Message), aqString.Quote(strValue)), _
oMsgWin.Message & vbCrLf & strValue, , , page.PagePicture)
Call oMsgWin.Button("OK").ClickButton()
End If
SystemDialogFileOpen = strValue
End Function
'-----------------------------------------------------------------------------