How to use _get_tab_children method in pyatom

Best Python code snippet using pyatom_python

page_tab_list.py

Source:page_tab_list.py Github

copy

Full Screen

...18import fnmatch19from utils import Utils20from server_exception import LdtpServerException21class PageTabList(Utils):22 def _get_tab_children(self, window_name, object_name):23 object_handle = self._get_object_handle(window_name, object_name)24 if not object_handle:25 raise LdtpServerException(u"Unable to find object %s" % object_name)26 return object_handle.AXChildren27 def _get_tab_handle(self, window_name, object_name, tab_name):28 children = self._get_tab_children(window_name, object_name)29 tab_handle = None30 for current_tab in children:31 role, label = self._ldtpize_accessible(current_tab)32 tmp_tab_name = fnmatch.translate(tab_name)33 if re.match(tmp_tab_name, label) or \34 re.match(tmp_tab_name, u"%s%s" % (role, label)):35 tab_handle = current_tab36 break37 if not tab_handle:38 raise LdtpServerException(u"Unable to find tab %s" % tab_name)39 if not tab_handle.AXEnabled:40 raise LdtpServerException(u"Object %s state disabled" % object_name)41 return tab_handle42 def selecttab(self, window_name, object_name, tab_name):43 """44 Select tab based on name.45 46 @param window_name: Window name to type in, either full name,47 LDTP's name convention, or a Unix glob.48 @type window_name: string49 @param object_name: Object name to type in, either full name,50 LDTP's name convention, or a Unix glob. 51 @type object_name: string52 @param tab_name: tab to select53 @type data: string54 @return: 1 on success.55 @rtype: integer56 """57 tab_handle = self._get_tab_handle(window_name, object_name, tab_name)58 tab_handle.Press()59 return 160 def selecttabindex(self, window_name, object_name, tab_index):61 """62 Select tab based on index.63 64 @param window_name: Window name to type in, either full name,65 LDTP's name convention, or a Unix glob.66 @type window_name: string67 @param object_name: Object name to type in, either full name,68 LDTP's name convention, or a Unix glob. 69 @type object_name: string70 @param tab_index: tab to select71 @type data: integer72 @return: 1 on success.73 @rtype: integer74 """75 children = self._get_tab_children(window_name, object_name)76 length = len(children)77 if tab_index < 0 or tab_index > length:78 raise LdtpServerException(u"Invalid tab index %s" % tab_index)79 tab_handle = children[tab_index]80 if not tab_handle.AXEnabled:81 raise LdtpServerException(u"Object %s state disabled" % object_name)82 tab_handle.Press()83 return 184 def verifytabname(self, window_name, object_name, tab_name):85 """86 Verify tab name.87 88 @param window_name: Window name to type in, either full name,89 LDTP's name convention, or a Unix glob.90 @type window_name: string91 @param object_name: Object name to type in, either full name,92 LDTP's name convention, or a Unix glob. 93 @type object_name: string94 @param tab_name: tab to select95 @type data: string96 @return: 1 on success 0 on failure97 @rtype: integer98 """99 try:100 tab_handle = self._get_tab_handle(window_name, object_name, tab_name)101 if tab_handle.AXValue:102 return 1103 except LdtpServerException:104 pass105 return 0106 def gettabcount(self, window_name, object_name):107 """108 Get tab count.109 110 @param window_name: Window name to type in, either full name,111 LDTP's name convention, or a Unix glob.112 @type window_name: string113 @param object_name: Object name to type in, either full name,114 LDTP's name convention, or a Unix glob. 115 @type object_name: string116 @return: tab count on success.117 @rtype: integer118 """119 children = self._get_tab_children(window_name, object_name)120 return len(children)121 def gettabname(self, window_name, object_name, tab_index):122 """123 Get tab name124 125 @param window_name: Window name to type in, either full name,126 LDTP's name convention, or a Unix glob.127 @type window_name: string128 @param object_name: Object name to type in, either full name,129 LDTP's name convention, or a Unix glob. 130 @type object_name: string131 @param tab_index: Index of tab (zero based index)132 @type object_name: int133 @return: text on success.134 @rtype: string135 """136 children = self._get_tab_children(window_name, object_name)137 length = len(children)138 if tab_index < 0 or tab_index > length:139 raise LdtpServerException(u"Invalid tab index %s" % tab_index)140 tab_handle = children[tab_index]141 if not tab_handle.AXEnabled:142 raise LdtpServerException(u"Object %s state disabled" % object_name)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful