1

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. I want to select a 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.

This are the results from the object identification centre

T.Naz
  • 125
  • 8
  • Hi there, the Object Identifier is not the object repository. The error is that your object is not in the OR. The identifier (the spy) is a view of the properties UFT sees in your application, but the OR is a location which stores multiple properties for you test to uniquely identify objects. Assuming you're using a local OR you can get to this by going to the solution explorer, expanding action1 and double clicking on "local". You should have an entry with a LOGICAL NAME "Profil 1 - Microsoft​ Edge" of class type Window. if it's not there, or has a different name, that is your error – RichEdwards Aug 31 '22 at 13:03
  • also, off topic, why "SQS" in SQS_ReportEvent - is that a company name in your function? – RichEdwards Aug 31 '22 at 13:06
  • also, without the data passed, we cannot really see where the "Profil 1" value is passed, and how. – TheBlastOne Nov 10 '22 at 07:52

0 Answers0