All pastes #183213 Raw Edit

richee

public text v1 · immutable
#183213 ·published 2006-09-26 18:23 UTC
rendered paste body
from ldtp import *
from ldtputils import *

log('Firefox 3.0', 'teststart')
firefox3 = LdtpDataFileParser ()
try:
    firefox3.setfilename('firefox3.0.xml')
    launchPath = firefox3.gettagvalue('launchpath')
    profile2use = firefox3.gettagvalue('spooky')

    firefoxPath = 'firefox'
    if launchPath != []:
        firefoxPath = launchPath[0] + '/' + firefoxPath
    if profile2use != []:
        firefoxPath = firefoxPath + ' -P ' + profile2use[0]
    launchapp(firefoxPath, 1)

    # Wait till window appears

    waittillguiexist('*-Minefield')

    # Open new window from Firefox file menu

    selectmenuitem('*-Minefield','mnuFile;mnuNewWindow')
    wait(3) 
    
    # Open new tab from Firefox file menu

    selectmenuitem('*-Minefield','mnuFile;mnuNewTab')

    # Open local file named test.html and it displays the contents of that html file
    
    selectmenuitem('*-Minefield', 'mnuFile;mnuOpenFile')
    wait(3)
    waittillguiexist('dlgOpenFile')
    selectrow('dlgOpenFile', 'tblFiles', 'test.html') # Recommend to use Data XML, instead of hard coding file name
    click('dlgOpenFile', 'btnOpen')
    
    
    # Save as option from the file menu, currently disabled because of issues while creating a new folder and also closing the downloads window

    # selectmenuitem('*-Minefield', 'mnuFile;mnuSavePageAs')
#   wait(3)
#   settextvalue('dlgSaveAs', 'txtName', 'newpage.html')
#   wait(3)
#   click('dlgSaveAs', 'tbtnBrowseforotherfolders')
#   wait(3)
#   click('dlgSaveAs', 'tbtnashish')
#   wait(3)
#   #click('dlgSaveAs', 'btnCreateFolder')
#   wait(3)
#   click('dlgSaveAs', 'btnSave')
#   wait(3)
#   x = ldtp.getobjectlist('Downloads')
#   print x
#   click('frmDownloads','btnCleanUp')
    wait(3)

    # Send Link in the file menu

    selectmenuitem('*-Minefield', 'mnuFile;mnuSendLink')
    waittillguiexist('Google')
    wait(3)
    selectmenuitem('Google', 'mnuFile;mnuClose')
    
    # Print Preview option in the file menu

    selectmenuitem('*-Minefield', 'mnuFile;mnuPrintPreview')
    wait(3)
    click ('Google-*', 'btnClose')
    wait(3)

    # Work Offline (Currently commented out coz of some issue, not working)
    
    #wait(3)
    #selectmenuitem('*-Minefield', 'mnuFile;mnuWorkOffline')

    # Now, it's time to say bye to firefox
    
    selectmenuitem('*-Minefield', 'mnuFile;mnuQuit')
    wait(3)
    click('dlgConfirmclose', 'btnClosetabs')

except LdtpExecutionError, msg:
    log('Firefox 3.0 automation script execution: ' + str(msg), 'fail')
    log('Firefox 3.0', 'teststop')