def get_facts_value_by_name(self, facts_name): if RHSMGuiLocator().get_os_serials() == "6": for row in range(ldtp.getrowcount(RHSMGuiLocator().get_locator("system-facts-dialog"), RHSMGuiLocator().get_locator("facts-view-table"))): if(ldtp.getcellvalue(RHSMGuiLocator().get_locator("system-facts-dialog"), RHSMGuiLocator().get_locator("facts-view-table"), row, 0).strip() == facts_name): logger.info("get_facts_value_by_name") return ldtp.getcellvalue(RHSMGuiLocator().get_locator("system-facts-dialog"), RHSMGuiLocator().get_locator("facts-view-table"), row, 1) raise FailException("Test Failed - Failed to get_facts_value_by_name.")
def check_small_business_integrity(): if (ldtp.getrowcount(main_window, 'tblTableContent') != 9): raise ldtp.LdtpExecutionError( "Newly created database does not contain all 8 rows" ) # Note there is one placeholder row ldtp.selecttab(main_window, 'ptlListOrDetailsView', 'Details')
def _quickgettablerowindex(self, window, table, target): numrows = ldtp.getrowcount(window, table) for i in range(0,numrows): try: value = ldtp.getcellvalue(window, table, i, 0) if self._matches(target,value): ldtp.selectrowindex(window, table, i) return i except: continue raise Exception("Item not found in table!")
def _gettablerowindex(self, window, table, target): numrows = ldtp.getrowcount(window, table) numcols = len(ldtp.getobjectproperty(window, table, 'children').split()) for i in range(0,numrows): for j in range(0,numcols): try: value = ldtp.getcellvalue(window, table, i, j) if self._matches(target,value): ldtp.selectrowindex(window, table, i) return i except: continue raise Exception("Item not found in table!")
def get_row_count(self, window_name, object_name): """ Description: Get count of rows in table object. :param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. :param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy :return: Number of rows. """ try: self._info("get row count of table [%s, %s]" % (window_name, object_name)) return ldtp.getrowcount(window_name, object_name) except LdtpExecutionError: raise LdtpExecutionError("get row count of table failed")
def to_script( self, val ,flag ,key=None): print flag if(define.NORMAL==flag): val = val.replace( "<parent>", "\"%s\""%self.parent ) val = val.replace( "<self>", "\"%s\""%self.self ) if(define.PTAB==flag): #ptab flag=1 val=val.replace("<parent>","\"%s\""%self.parent) val=val.replace("<tab_list_name>","\"ptl0\"") tmp=ldtp.getobjectproperty(self.parent,self.self,'child_index') val=val.replace("<self_index>","%d"%tmp) if(define.LST==flag): #lst flag=2 val=val.replace("<parent>","\"%s\""%self.parent) val=val.replace("<component_name>","\"%s\""%key) tmp=ldtp.getobjectproperty(self.parent,self.self,'child_index') val=val.replace("<self_index>","%d"%tmp) if(define.MNU_ITEM==flag): #mnu_item flag=3 val=val.replace("<parent>","\"%s\""%self.parent) val=val.replace("<mnu;mnuitem>","\"%s\""%key) if(define.TBL==flag): #tbl flag=4 val=val.replace("<parent>","\"%s\""%self.parent) val=val.replace("<self>","\"%s\""%self.self) tmp=ldtp.getrowcount(self.parent,self.self) val=val.replace("<child_index>","0~%d"%(tmp-1)) return val
def get_table_row_count(self, window, table_name): return ldtp.getrowcount(RHSMGuiLocator().get_locator(window), RHSMGuiLocator().get_locator(table_name))
def check_small_business_integrity(): if(ldtp.getrowcount(main_window, 'tblTableContent') != 9): raise ldtp.LdtpExecutionError("Newly created database does not contain all 8 rows"); # Note there is one placeholder row ldtp.selecttab(main_window, 'ptlListOrDetailsView', 'Details')