def get_text_value(self, window_name, object_name): """ *[关键字概要]* 获取Text文本框内容 :@参数 window_name: 窗口名称 :@参数 object_name: 对象名称 :@返回值: 文本框内容 *Examples*: | *Test Cases* | *Returns* | *Action* | *Arguments* | *Arguments* | | Example_Test | ${text}= | Get Text Value | ${FRM_NAME} | ${TXT_NAME} | """ try: self._info("get text value ... (%s, %s)" % (window_name, object_name)) # print("*INFO* get text value ... [%s, %s]\r\n" % (window_name, object_name)) return ldtp.gettextvalue(window_name, object_name) except LdtpExecutionError: raise LdtpExecutionError( "get text value failed, please check if the input parameters are correct. " )
def _gettextvalue(self, window_name, object_name, startPosition=None, endPosition=None): def findFirst(node, search_string): try: children = node.children except: return None for child in children: if self._matches(search_string, child.name): return child else: child = findFirst(child,search_string) if child: return child retval = "" if ldtp.getobjectproperty(window_name, object_name, "class") == "label": f = dogtail.tree.root.application('subscription-manager-gui') w = f.childNamed(window_name) o = findFirst(w, object_name) if o: retval = o.text else: raise Exception("Cannot find object: %s in tree."%(object_name)) else: retval = ldtp.gettextvalue(window_name, object_name, startPosition, endPosition) if not ((isinstance(retval, str) or isinstance(retval, unicode))): retval = "" return retval
def check_server_url(self, server_url): if ldtp.gettextvalue(RHSMGuiLocator().get_locator("register-dialog"), RHSMGuiLocator().get_locator("server-url-text")) == server_url: return True else: return False
def getTextFieldValue(windowName, txtName): if windowName is None or windowName == '': return None if txtName is None or txtName == '': return None return ldtp.gettextvalue(windowName, txtName)