Example #1
0
def step_impl(context, popupwin, entry, win):
    click_those = l.getobjectlist(win)
    for thing in click_those:
        l.mouserightclick(win, thing)
        if l.waittillguiexist(popupwin, entry, 1): return
        l.generatekeyevent("<esc>") #close possible menus
        time.sleep(0.5)
    #not found
    assert(False)
Example #2
0
def do_screenshot(app, app_name):
    show("Next up is: {} ({})".format(app_name, app))
    l.launchapp(app)
    l.waittillguiexist(app_name)
    if video:
        time.sleep(5)
    l.imagecapture(app_name, os.path.join(basePath, app + ".png"))
    full_screen=l.imagecapture()
    shutil.move(full_screen, os.path.join(basePath, "fullscreen-" + app + ".png"))
    l.generatekeyevent("<alt><f4>")
    def to_uplist(self,name):
	# 查找类似"btn下划线"的特殊子窗口,需先关闭软件,不然找不到
	ldtp.launchapp('liteword')
	lst1=ldtp.getwindowlist()
	ldtp.click(define.special_updlg.get(name),name)
	ldtp.generatekeyevent('<up>')
	lst2=ldtp.getwindowlist()
	ret=list(set(lst1)^set(lst2))
	print 'hehe :',ret
	if ret:
		for i in ret:
			if i.startswith("dlg"):
				return i
Example #4
0
	def create_new_file(self,window_name):
		if self.os_family == 'windows':
			if self.os_check not in  ["Win_8"]:
				ldtp.mouseleftclick(window_name,'paneShellFolderView')
				ldtp.generatekeyevent('<alt>f')
				ldtp.keypress('w')
				ldtp.keypress('t')
			else:
				try:
					ldtp.click(window_name,'uknNewitem')
				except:
					ldtp.click(window_name,'btnMinimizetheRibbon')
					ldtp.click(window_name,'uknNewitem')
				time.sleep(2)
				ldtp.selectmenuitem('frmNewitem','mnuTextDocument')
				time.sleep(2)
			ldtp.generatekeyevent("%s<enter>" % str(int(time.time())))
Example #5
0
def step_impl(context, popupwin, entry, win):
    click_those = l.getobjectlist(win)
    for thing in click_those:
        (x, y, w, h) = l.getobjectsize(win, thing)
        # expecting the object to consist of square shaped icons
        # so let's click in the middle of those
        click_x = x + (h / 2)
        click_y = y + (h / 2)
        while click_x < (x + w):
            context._root["_click_animated"](context,
                                             click_x,
                                             click_y,
                                             button="b3c",
                                             delay=0)
            if l.waittillguiexist(popupwin, entry, 1): return
            l.generatekeyevent("<esc>")  #close possible menus
            time.sleep(0.5)
            click_x += h
    #not found
    assert (False)
Example #6
0
    def baobab_scan_folder(self, path):
        baobab = ooldtp.context(self.name)

        baobab.getchild(self.BTN_SCANFOLDER).click()

        ldtp.waittillguiexist(self.DLG_SELECTFOLDER)

        if (ldtp.guiexist(self.DLG_SELECTFOLDER)):
            selectFiles = ooldtp.context(self.DLG_SELECTFOLDER)
            if not (selectFiles.getchild(self.TXT_LOCATION)):
                ldtp.generatekeyevent('<ctrl>l')
            textLocation = selectFiles.getchild(self.TXT_LOCATION)
            textLocation.settextvalue(path)
            ldtp.generatekeyevent('<return>')
        ldtp.wait(2)

        buttonStop = baobab.getchild(self.BTN_STOP)

        while buttonStop.stateenabled():
            ldtp.wait()

        self.baobab_change_views()
Example #7
0
    def baobab_scan_folder(self, path):
        baobab = ooldtp.context(self.name)
        
        baobab.getchild(self.BTN_SCANFOLDER).click()

        ldtp.waittillguiexist(self.DLG_SELECTFOLDER)
        
        if (ldtp.guiexist(self.DLG_SELECTFOLDER)):
            selectFiles = ooldtp.context(self.DLG_SELECTFOLDER)
            if not (selectFiles.getchild(self.TXT_LOCATION)):
                ldtp.generatekeyevent('<ctrl>l')
            textLocation = selectFiles.getchild(self.TXT_LOCATION)
            textLocation.settextvalue(path)
            ldtp.generatekeyevent('<return>')
        ldtp.wait(2)
                
        buttonStop = baobab.getchild(self.BTN_STOP)
        
        while buttonStop.stateenabled():
            ldtp.wait()
        
        self.baobab_change_views()
Example #8
0
    def generate_key_event(self, data):
        """
        Functionality of generatekeyevent is similar to typekey of LTFX project.
        Used SPI_generateKeyboardEvent to generate the keyboard events.

        :param data:

        :return: Returns 1 on success, LdtpExecutionError exception will be thrown on failure
        """
        try:
            self._info("generate key event with <%s>" % data)
            return ldtp.generatekeyevent(data)
        except LdtpExecutionError as e:
            print(e.message)
            raise LdtpExecutionError
Example #9
0
 def _diabled_for_now_test_search_scroll_down_hang(self):
     context = ooldtp.context(self.window_name)
     ldtp.wait(2)
     context.enterstring(self.availablePaneSearchEntry, "a")
     ldtp.wait(1)
     row_count = context.getrowcount(self.availablePaneAppView)
     # ensure we get enough hits
     self.assertTrue(row_count > 10)
     ldtp.generatekeyevent("<tab>")
     # repeating this 100 times will eventually hang s-c, its
     # currently unclear why
     for i in range(100):
         self.generate_page_down()
         ldtp.wait(1)
         ldtp.generatekeyevent("<enter>")
         ldtp.wait(1)
         ldtp.generatekeyevent("<backspace>")
         ldtp.wait(1)
Example #10
0
 def _diabled_for_now_test_search_scroll_down_hang(self):
     context = ooldtp.context(self.window_name)
     ldtp.wait(2)
     context.enterstring(self.availablePaneSearchEntry, "a")
     ldtp.wait(1)
     row_count = context.getrowcount(self.availablePaneAppView)
     # ensure we get enough hits
     self.assertTrue(row_count > 10)
     ldtp.generatekeyevent("<tab>")
     # repeating this 100 times will eventually hang s-c, its
     # currently unclear why
     for i in range(100):
         self.generate_page_down()
         ldtp.wait(1)
         ldtp.generatekeyevent("<enter>")
         ldtp.wait(1)
         ldtp.generatekeyevent("<backspace>")
         ldtp.wait(1)
Example #11
0
def do_screenshot(app, app_name):
    l.launchapp(app)
    l.waittillguiexist(app_name)
    l.imagecapture(app_name, os.path.join(basePath, app + ".png"))
    l.generatekeyevent("<alt><f4>")
Example #12
0

def do_screenshot(app, app_name):
    l.launchapp(app)
    l.waittillguiexist(app_name)
    l.imagecapture(app_name, os.path.join(basePath, app + ".png"))
    l.generatekeyevent("<alt><f4>")


full_screen = l.imagecapture()
os.rename(full_screen, os.path.join(basePath, "xfce-desktop.png"))

# I/O error workaround
l.launchapp("xfce4-terminal")
time.sleep(1)
l.generatekeyevent("<alt><f4>")

# move the mouse away to avoid tool tips
l.generatemouseevent(800, 600, "abs")

# appfinder crashes on imagecapture() - (has to window?)
l.launchapp("xfce4-appfinder")
l.waittillguiexist("ApplicationFinder")
full_screen = l.imagecapture()
os.rename(full_screen, os.path.join(basePath, "xfce4-appfinder-main.png"))
l.generatekeyevent("<alt><f4>")

do_screenshot("xfce4-terminal", "Terminal")
do_screenshot("xfce4-clipman-settings", "Clipman")
do_screenshot("xfce4-display-settings", "Display")
do_screenshot("xfce4-keyboard-settings", "Keyboard")
Example #13
0
wait_for_object(frm, 'btnNext>')
frm.click('btnNext>')
wait_for_object(frm, 'btnNext>', 60, 1)
frm.settextvalue('txt7', '/tmp/kjfojgo/Qt')  # Qt install path
wait_for_object(frm, 'btnNext>')
frm.click('btnNext>')
wait_for_object(frm, 'btnNext>')
frm.doubleclickrow('tree0', 'Qt')
ldtp.wait(0.1)
frm.doubleclickrow('tree0', 'Qt 5.10.0')  # select Qt version
ldtp.wait(0.1)
frm.doubleclickrow('tree0', '*gcc*')
ldtp.wait(0.1)
#ldtp.generatekeyevent('<space>')
ldtp.wait(0.1)
frm.doubleclickrow('tree0', 'Qt WebEngine')
ldtp.wait(0.1)
#ldtp.generatekeyevent('<space>')
ldtp.wait(0.1)
frm.click('btnNext>')
ldtp.wait(0.1)
ldtp.generatekeyevent('<tab><tab><up><space>')  # agree to terms
frm.click('btnNext>')
wait_for_object(frm, 'btnInstall')
frm.click('btnInstall')
wait_for_object(frm, 'btnFinish', 10 * 60, 5)
ldtp.wait(0.1)
ldtp.generatekeyevent('<tab><space>')  # Don't launch Qt Creator
ldtp.wait(0.1)
frm.click('btnFinish')
Example #14
0
 def sendkeys(self, control, keys):
     return ldtp.generatekeyevent(keys)
Example #15
0
 def sendkeys(self, control, keys):
     return ldtp.generatekeyevent(keys)
Example #16
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)
Example #17
0
def step_impl(context, key):
    l.generatekeyevent(key)
    time.sleep(1) # input usually needs a task switch to some UI thread to process it
Example #18
0
def do_screenshot(app, app_name):
    l.launchapp(app)
    l.waittillguiexist(app_name)
    l.imagecapture(app_name, os.path.join(basePath, app + ".png"))
    l.generatekeyevent("<alt><f4>")
Example #19
0
    os.mkdir(basePath)

def do_screenshot(app, app_name):
    l.launchapp(app)
    l.waittillguiexist(app_name)
    l.imagecapture(app_name, os.path.join(basePath, app + ".png"))
    l.generatekeyevent("<alt><f4>")


full_screen=l.imagecapture()
os.rename(full_screen, os.path.join(basePath, "xfce-desktop.png"))

# I/O error workaround
l.launchapp("xfce4-terminal")
time.sleep(1)
l.generatekeyevent("<alt><f4>")


# move the mouse away to avoid tool tips
l.generatemouseevent(800,600, "abs")

# appfinder crashes on imagecapture() - (has to window?)
l.launchapp("xfce4-appfinder")
l.waittillguiexist("ApplicationFinder")
full_screen=l.imagecapture()
os.rename(full_screen, os.path.join(basePath, "xfce4-appfinder-main.png"))
l.generatekeyevent("<alt><f4>")

do_screenshot("xfce4-terminal", "Terminal")
do_screenshot("xfce4-clipman-settings", "Clipman")
do_screenshot("xfce4-display-settings", "Display")
Example #20
0
 def sendkeys(self, keys):
     """Sends keys from :keys String. See
     `LDTP generatekeyevent documentation <http://ldtp.freedesktop.org/user-doc/d7/d6e/a00190.html>`_
     for a list of supported key-events.
     """
     generatekeyevent(keys)
Example #21
0
def step_impl(context, text):
    l.generatekeyevent(text)
Example #22
0
	def send_keys_to_current_focused_object(self, keys):
		'''
			Send keys to current focused object/window
		'''		
		ldtp.generatekeyevent(keys)