All pastes #190850 Raw Edit

richee

public text v1 · immutable
·published 2006-10-04 11:35 UTC
rendered paste body
#!/usr/bin/python

#
#  Linux Desktop Testing Project http://ldtp.freedesktop.org
#
#  Author:
#     Ashish Rajasekhar  <ashish@ashishr.net>
#     Sudharshan S <sudharsh@gmail.com>
#
#  Copyright 2006 to Ashish and Sudharsh
#
#  This script is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Library General Public
#  License as published by the Free Software Foundation; either
#  version 2 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Library General Public License for more details.
#
#  You should have received a copy of the GNU Library General Public
#  License along with this library; if not, write to the
#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#  Boston, MA 02111-1307, USA.
#

from ldtp import *
from ldtputils import *

# Launching firefox with a profile name with the path specified in firefox3.0.xml file

from ldtp import *
from ldtputils import *
home_url = 'http://ldtp.freedesktop.org'
log('Firefox 3.0', 'teststart')
firefox3 = LdtpDataFileParser ()
try:
    firefox3.setfilename('firefox3.0.xml')
    launchPath = firefox3.gettagvalue('launchpath')
    profile2use = firefox3.gettagvalue('profile')
    firefoxPath = 'firefox'
    if launchPath != []:
        firefoxPath = launchPath[0] + '/' + firefoxPath
    if profile2use != []:
        firefoxPath = firefoxPath + ' -P ' + profile2use[0]

    # Launching the firefox minefield browser
    
    launchapp(firefoxPath, 1)
    waittillguiexist('*Minefield')

    # Opening the dialog preferences and setting the default homepage
    
    try:
        selectmenuitem('*Minefield', 'mnuEdit;mnuPreferences')
        waittillguiexist('dlgMinefieldPreferences')
        wait(3)
        xyz = comboselect ('dlgMinefieldPreferences', 'cboWhenMinefieldstarts', 'Show my home page')
        print xyz
        wait(3)
        click('dlgMinefieldPreferences', 'btnClose')
        wait(3)
        click('*Minefield', 'btnHome')
        wait(3)
        print 'Hey successfully exit the program after setting the homepage'
        
    except:
         log('The homepage could not be changed', 'error')

    # Opening the dialog preferences and setting the default homepage to a blankpage

    try:
        selectmenuitem('*Minefield', 'mnuEdit;mnuPreferences')
        waittillguiexist('dlgMinefieldPreferences')
        wait(3)
        comboselect ('dlgMinefieldPreferences', 'cboWhenMinefieldstarts', 'Show a blank page')
        wait(3)
        click('dlgMinefieldPreferences', 'btnClose')
        wait(3)
        selectmenuitem('*Minefield', 'mnuFile;mnuQuit')
        wait(3)
        launchapp(firefoxPath,1)
        wait(6)
        selectmenuitem('*Minefield', 'mnuFile;mnuQuit')
    except:
       log('The homepage could not be changed to a blankpage', 'error')
                                                                                                                            
                                        
except LdtpExecutionError, msg:
    log('Firefox 3.0 automation script execution: ' + str(msg), 'fail')
    log('Firefox 3.0', 'teststop')