예제 #1
0
	def write_text(self, msg, window_name, object_name, text):
		'''
			Clear the previous text and enter the text
		'''
		logger.debug(msg)
		ldtp.deletetext(window_name, object_name, 0)
		ldtp.enterstring(window_name, object_name, text)
예제 #2
0
파일: main.py 프로젝트: zoushidong/mago
    def write_text(self, text, txt_field=''):
        """
        Given an application it tries to write text to its current buffer.
        """
        app = ooldtp.context(self.name)

        if txt_field == '':
            ldtp.enterstring(text)
        else:
            app_txt_fields = app.getchild(txt_field, "text")
            for field in app_txt_fields:
                field.settextvalue(text)
예제 #3
0
파일: main.py 프로젝트: zoushidong/mago
    def write_text(self, text, txt_field=''):
        """
        Given an application it tries to write text to its current buffer.
        """
        app = ooldtp.context(self.name)

        if txt_field == '':
            ldtp.enterstring(text)
        else:
            app_txt_fields = app.getchild(txt_field, "text")
            for field in app_txt_fields:
                field.settextvalue(text)
예제 #4
0
    def enter_string(self, window_name, object_name='', data=''):
        """
        Description: Functionality of enterstring is similar to typekey of LTFX project.
        Main difference is this function works based on accessibility. So, we could specify the window name,
         object name and finally the data string.

        :param window_name:

        :param object_name:

        :param data:

        :return: Returns 1 on success, LdtpExecutionError exception will be thrown on failure
        """
        try:
            self._info("enter string with keyboard")
            return ldtp.enterstring(window_name, object_name, data)
        except LdtpExecutionError:
            raise LdtpExecutionError("enter string with keyboard failed")
import sys
import ldtp
import Image
import ImageChops
from commandes_bases import *

connecter()

ajouterFiche()

ldtp.click('*Gestion de dossiers*', 'btnAjouter')
ldtp.waittillguiexist('*une nouvelle fiche*')
ldtp.mouseleftclick('*une nouvelle fiche*', 'txt0')
ldtp.enterstring('*une nouvelle fiche*', 'txt0', "bonjour comment ca va")
ldtp.mouseleftclick('*une nouvelle fiche*', 'cboDown')
ldtp.mouseleftclick('*une nouvelle fiche*', 'lstInstallationavecbackup')
ldtp.mouseleftclick('*une nouvelle fiche*', 'sldr0')
ldtp.enterstring('*une nouvelle fiche*', 'sldr0', "<del>2")
ldtp.click('*une nouvelle fiche*', 'btnSaveEnter')

coordinate = ldtp.getobjectsize('*Gestion de dossiers*', 'pane0')
if (len(sys.argv) > 1) and (sys.argv[1] == 'origin'):
    ldtp.imagecapture('*Gestion de dossiers*', 'images/creer_fiche_test_priorite2_origin.png',
                      coordinate[0], coordinate[1], coordinate[2], coordinate[3])
else:
    ldtp.imagecapture('*Gestion de dossiers*', 'images/creer_fiche_test_priorite2.png',
                      coordinate[0], coordinate[1], coordinate[2], coordinate[3])
    im1 = Image.open("images/creer_fiche_test_priorite2.png")
    im2 = Image.open("images/creer_fiche_test_priorite2_origin.png")
    diff = ImageChops.difference(im2, im1)
    if diff.getbbox():
traiterFiche()

fenetre = "*Traitement d'une fiche de maintenance*"
ldtp.waittillguiexist(fenetre)
ldtp.click(fenetre, u"btnPi\xe8ces")

fenetre = "*une nouvelle*"
ldtp.waittillguiexist(fenetre)
ldtp.mouseleftclick(fenetre, 'txt1')
ajouterPressePapier("Lorem ipsum dolor sit amet, consectetur adipiscing elit. In rhoncus felis sed condimentum pretium. Etiam vulputate sapien eu massa consectetur imperdiet. Nunc non pulvinar magna. Donec fermentum sagittis condimentum. Vivamus et quam nec ante turpis ")
ldtp.keypress('<ctrl>')
ldtp.keypress('v')
ldtp.keyrelease('<ctrl>')
ldtp.mouseleftclick(fenetre, 'sldr0')
ldtp.enterstring(fenetre, 'txt0', "<del><del><del><del><del>999,99")
ldtp.click(fenetre, 'btnCancel')

ldtp.click("*Traitement d'une fiche de maintenance*", 'btnSaveEnter')
ldtp.click('*Gestion de dossiers*', 'btnTraiter')
fenetre = "*Traitement d'une fiche de maintenance*"
ldtp.waittillguiexist(fenetre)

coordinate = ldtp.getwindowsize(fenetre)
if (len(sys.argv) > 1) and (sys.argv[1] == 'origin'):
	ldtp.imagecapture(fenetre, 'images/ajouter_piece_test_annuler_origin.png',
                      coordinate[0], coordinate[1], coordinate[2], coordinate[3])
else:
    ldtp.imagecapture(fenetre, 'images/ajouter_piece_test_annuler.png',
                      coordinate[0], coordinate[1], coordinate[2], coordinate[3])
    im1 = Image.open("images/ajouter_piece_test_annuler.png")
from commandes_bases import *

connecter()

traiterFiche()

fenetre = "*Traitement d'une fiche de maintenance*"
ldtp.waittillguiexist(fenetre)

ldtp.mouseleftclick(fenetre, 'txtFiche#13')
ldtp.keypress('<ctrl>')
ldtp.keypress('a')
ldtp.keyrelease('<ctrl>')
ldtp.keypress('<bksp>')
ldtp.keyrelease('<bksp>')
ldtp.enterstring(fenetre, 'txtFiche#13', 'allo mon grand')
ldtp.click(fenetre, 'btnCancel')

ldtp.click('*Gestion de dossiers*', 'btnTraiter')
ldtp.waittillguiexist(fenetre)

coordinate = ldtp.getwindowsize(fenetre)
if (len(sys.argv) > 1) and (sys.argv[1] == 'origin'):
	ldtp.imagecapture(fenetre, 'images/traiter_fiche_commentaire_basse_origin.png',
                      coordinate[0], coordinate[1], coordinate[2], coordinate[3])
else:
    ldtp.imagecapture(fenetre, 'images/traiter_fiche_commentaire_basse.png',
                      coordinate[0], coordinate[1], coordinate[2], coordinate[3])
    im1 = Image.open("images/traiter_fiche_commentaire_basse.png")
    im2 = Image.open("images/traiter_fiche_commentaire_basse_origin.png")
    diff = ImageChops.difference(im2, im1)
import Image
import ImageChops
from commandes_bases import *

connecter()

traiterFiche()

fenetre = "*Traitement d'une fiche de maintenance*"
ldtp.waittillguiexist(fenetre)
ldtp.click(fenetre, u"btnPi\xe8ces")

fenetre = "*une nouvelle*"
ldtp.waittillguiexist(fenetre)
ldtp.mouseleftclick(fenetre, 'txt1')
ldtp.enterstring(fenetre, 'txt1', "disque dur")
#ldtp.mouseleftclick(fenetre, 'txt0')
#ldtp.enterstring(fenetre, 'txt0', "")
ldtp.mouseleftclick(fenetre, 'sldr0')
ldtp.enterstring(fenetre, 'txt0', "<del><del><del><del><del>999,99")
ldtp.click(fenetre, 'btnSaveEnter')

fenetre = "*Traitement d'une fiche de maintenance*"
coordinate = ldtp.getobjectsize(fenetre, 'tbl1')
ldtp.generatemouseevent(coordinate[0]+120, coordinate[1]+35, 'b1d')
ldtp.keypress('<ctrl>')
ldtp.keypress('a')
ldtp.keyrelease('<ctrl>')
ldtp.keypress('<bksp>')
ldtp.keyrelease('<bksp>')
connecter()

traiterFiche()

fenetre = "*Traitement d'une fiche de maintenance*"
ldtp.waittillguiexist(fenetre)
ldtp.click(fenetre, u'btnT\xe2ches')

fenetre = "*Ajouter une*"
ldtp.waittillguiexist(fenetre)
ldtp.mouseleftclick(fenetre, 'cboDown')
ldtp.mouseleftclick(fenetre, 'lstCombofix')
ldtp.mouseleftclick(fenetre, 'cboDown1')
ldtp.mouseleftclick(fenetre, 'lstEncours')
ldtp.mouseleftclick(fenetre, 'txt0')
ldtp.enterstring(fenetre, 'txt0', "allo")
ldtp.click(fenetre, 'btnSaveEnter')

fenetre = "*Traitement d'une fiche de maintenance*"
coordinate = ldtp.getobjectsize(fenetre, 'tbl0')
ldtp.generatemouseevent(coordinate[0]+120, coordinate[1]+35, 'b1d')
ldtp.keypress('<ctrl>')
ldtp.keypress('a')
ldtp.keyrelease('<ctrl>')
ldtp.keypress('<bksp>')
ldtp.keyrelease('<bksp>')

ajouterPressePapier("Lorem ipsum dolor sit amet, consectetur adipiscing elit. In rhoncus felis sed condimentum pretium. Etiam vulputate sapien eu massa consectetur imperdiet. Nunc non pulvinar magna. Donec fermentum sagittis condimentum. Vivamus et quam nec ante turpis ")
ldtp.keypress('<ctrl>')
ldtp.keypress('v')
ldtp.keyrelease('<ctrl>')
예제 #10
0
파일: utils.py 프로젝트: hamstah/quack
def send_keys(string):
    enterstring("*", "*", string)
import sys
import ldtp
import Image
import ImageChops
from commandes_bases import *

connecter()

traiterFiche()

fenetre = "*Traitement d'une fiche de maintenance*"
ldtp.waittillguiexist(fenetre)

ldtp.mouseleftclick(fenetre, 'sldrFiche#13')
ldtp.enterstring(fenetre, 'sldrFiche#13', '<del>1')
ldtp.click(fenetre, 'btnSaveEnter')

ldtp.click('*Gestion de dossiers*', 'btnTraiter')
ldtp.waittillguiexist(fenetre)

coordinate = ldtp.getwindowsize(fenetre)
if (len(sys.argv) > 1) and (sys.argv[1] == 'origin'):
	ldtp.imagecapture(fenetre, 'images/traiter_fiche_commentaire_basse_origin.png',
                      coordinate[0], coordinate[1], coordinate[2], coordinate[3])
else:
    ldtp.imagecapture(fenetre, 'images/traiter_fiche_commentaire_basse.png',
                      coordinate[0], coordinate[1], coordinate[2], coordinate[3])
    im1 = Image.open("images/traiter_fiche_commentaire_basse.png")
    im2 = Image.open("images/traiter_fiche_commentaire_basse_origin.png")
    diff = ImageChops.difference(im2, im1)
    if diff.getbbox():
예제 #12
0
	def go_to_dir(self, window_name, path):
		'''
			Got to a location in file system via explorer.
		'''
		if self.os_family == "windows":	
			# self.click_element("Go to location: Computer",window_name, 'uknComputer')
			object_name = "pane3"
			currWindowName = window_name
			tempWindowName = window_name
			if self.os_check == "Win_8":
				object_name="pane5"
				try:
					ldtp.doubleclick(tempWindowName,'tblcFavorites')
					tempWindowName  = 'Favorites'
					time.sleep(2)
					ldtp.generatekeyevent("<left>")
					ldtp.doubleclick(tempWindowName,'tblcLibraries')
					tempWindowName  = 'Libraries'
					time.sleep(2)
					ldtp.generatekeyevent("<left>")
					ldtp.doubleclick(tempWindowName,'tblcComputer')
					time.sleep(2)
				except:
					ldtp.mouseleftclick(tempWindowName,'ptabView')
					time.sleep(2)
					ldtp.mouseleftclick(tempWindowName,'uknNavigationpane')
					time.sleep(2)
					ldtp.mouseleftclick(tempWindowName,'mnuNavigationpane')
					time.sleep(2)
					try:
						ldtp.doubleclick(tempWindowName,'tblcFavorites')
						tempWindowName  = 'Favorites'
						ldtp.generatekeyevent("<left>")
						time.sleep(2)
						ldtp.doubleclick(tempWindowName,'tblcLibraries')
						tempWindowName = 'Libraries'
						ldtp.generatekeyevent("<left>")
						time.sleep(2)
					except:
						pass
					ldtp.doubleclick(tempWindowName,'tblcComputer')
					time.sleep(2)
					tempWindowName = 'Computer'
					
			elif self.os_check == "Win_7_Vista_XP":
					try:
						ldtp.doubleclick(tempWindowName, "tblcFavorites")
						tempWindowName = "Favorites"
						ldtp.generatekeyevent("<left>")
						time.sleep(2)
						ldtp.doubleclick(tempWindowName, "tblcLibraries")
						tempWindowName = 'Libraries'
						ldtp.generatekeyevent("<left>")
						time.sleep(2)
						ldtp.doubleclick(tempWindowName, "tblcComputer")
					except :
						ldtp.mouseleftclick(tempWindowName, "btnOrganize")
						time.sleep(2)
						ldtp.generatekeyevent("<l>")
						time.sleep(2)
						ldtp.generatekeyevent("<n>")
						time.sleep(2)
						ldtp.doubleclick(tempWindowName, "tblcFavorites")
						tempWindowName = "Favorites"
						ldtp.generatekeyevent("<left>")
						time.sleep(2)
						ldtp.doubleclick(tempWindowName, "tblcLibraries")
						tempWindowName = 'Libraries'
						ldtp.generatekeyevent("<left>")
						time.sleep(2)
						ldtp.doubleclick(tempWindowName, "tblcComputer")
						time.sleep(2)
			# self.click_element("Go to location: Computer",window_name, 'tblcComputer', double = True)
			self.click_element("Click on Address bar pane in explorer","Computer", object_name)		
			ldtp.enterstring("Computer", "txtAddress", r"%s<enter>" % path)	
			if self.os_check == "Win_8":
				tempWindowName = self.get_window_name_for_path(path)
				time.sleep(2)
				ldtp.mouseleftclick(tempWindowName,'ptabHome')
				time.sleep(2)
		elif self.os_family == "mac":
			if window_name.find("frm") == -1 : 
				window_name = "frm" +  window_name
			ldtp.selectmenuitem(window_name,"mnuGo;mnuGotoFolder*" )
			path = path.replace("C:","").replace("\\","/")
			time.sleep(1)
			self.send_keys_to_current_focused_object("%s<enter>" % path)
예제 #13
0
	def type_text(self, msg, window_name, object_name, text):
		'''
			Types text into an object the way a user would.
		'''		
		logger.debug(msg)
		ldtp.enterstring(window_name, object_name, text)