I want to upload a file to a website. When I click the upload button, then a pop-up window with the document explorer opens and I want UFT to select the file from this pop-up window.
This is my code:
Option Explicit
Dim objType, value, bcName
objType = "File"
value = "Dialog select"
bcName = objType & " " & value
Dim pDoit, pKommentar, pMyFile, pMyFolder
pDoit = CBool(evalVarAndOffset(Parameter("doit")))
If pDoit = True Then
getUserTempFolder
pKommentar = Parameter("Kommentar")
pMyFolder = evalVarAndOffset(Parameter("Ordner"))
pMyFile = replaceUnwantedCharsFromString(evalVarAndOffset(Parameter("Datei")))
Window("Profil 1 - Microsoft Edge").Dialog("Öffnen").Activate
Window("Profil 1 - Microsoft Edge").Dialog("Öffnen").WinEdit("Dateiname:").Set pMyFolder &
pMyFile
Window("Profil 1 - Microsoft Edge").Dialog("Öffnen").WinButton("Öffnen").Click
SQS_ReportEvent micPass, "BC '" & bcName & "' ausgeführt. Datei: " & pMyFile, "Datei: " &
pMyFile
Else
SQS_ReportEvent micPass, "BC '" & bcName & "' übersprungen.", "BC '" & bcName & "'
übersprungen."
End If
SQS_ReportEvent micDone, "BC '" & bcName & "' ausgeführt.", "BC '" & bcName & "' ausgeführt."
SQS_ActionFinish
The problem is that UFT isn't able to find the pop-up window named "Profil 1 - Microsoft Edge", although this is the name I find if I use the Object Identificator of UFT.
This is the error message I get:
The "Profil 1 - Microsoft Edge" Window object was not found in the Object Repository. Check the Object Repository to confirm that the object exists or to find the correct name for the object. Line (22): "Window("Profil 1 - Microsoft Edge").Dialog("Öffnen").Activate". Tip: If the objects in your application have changed, the Maintenance Run Mode can help you identify and update your steps and/or the objects in your repository.