All pastes #364510 Raw Edit

vam

public text v1 · immutable
#364510 ·published 2007-02-20 06:04 UTC
rendered paste body
from ldtp import *
from ldtputils import *
def attachFiles (attachment):
    try: 
        n_attachments=len (attachment)
        for i in range (n_attachment):
         selectmenuitem ('frmComposeMessage', 'mnuInsert;mnuAttachment')
        if waittillguiexist ('dlgInsertAttachment') == 0:
                msg = 'select file dialog does not appear'
                log(msg, 'error')
        raise LdtpExecutionError (msg)
        selectrow ('dlgInsertAttachment', 'tblFiles', attachment[i])
        click ('dlgInsertAttachment', 'btnAttach')
        if waittillguinotexist ('dlgInsertAttachment') == 0:
                msg='Select file dialog not closed'
                log(msg, 'error')
                raise LdtpExecutionError (msg)
    except ldtp.error, msg:
            log ('Attaching file ' + attachment[i] + ' failed' + str (msg), 'error')
    if guiexist ('dlgInsertAttachment'): 
        click ('dlgInsertAttachment', 'btnCancel')
        raise LdtpExecutionError (msg)