Forum Discussion

rickh_28's avatar
rickh_28
Occasional Contributor
10 years ago

Opening Attachments

The desktop app I'm testing allows users to create reports, then attach files to them.  I need to be able to open the attachments to make sure they attach correctly, but I'm stuck.  I can use a Click() function and plug in the coordinates, but I really want to avoid that so it won't break with different screen resoultions, etc.  Ideally, I'd iterate through the attachments and double-click each one.



The attachments are displayed in a text box, and when you double-click them, they open.  Using Object Spy, I can see the value of the text box is "<span style="text-decoration:underline;">attachment.txt (33Byte)</span><span style="text-decoration:underline;">attachment.doc(25KB)</span>... etc.



Suggestions?

1 Reply

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Rick,



    As a possible solution: search for those Span elements and click on them.

    E.g. (untested pseudocode):

    Set oTextBox = <parent text box>

    arrElements = oTextBox.FindAllChildren(Array("ObjectType"), Array("Span"), 10)

    For Each oElement In arrElements

      Call oElement.ScrollIntoView(False)

      Call Log.Message(aqString.Format("Clicking %s element", oElement.innerText), , , , Sys.Browser.Page.PagePicture)

      Call oElement.Click

    Next