How to use _get_object_map method in pyatom

Best Python code snippet using pyatom_python

core.py

Source:core.py Github

copy

Full Screen

...223 @return: list of properties224 @rtype: list225 """226 try:227 obj_info=self._get_object_map(window_name, object_name,228 wait_for_object=False)229 except atomac._a11y.ErrorInvalidUIElement:230 # During the test, when the window closed and reopened231 # ErrorInvalidUIElement exception will be thrown232 self._windows={}233 # Call the method again, after updating apps234 obj_info=self._get_object_map(window_name, object_name,235 wait_for_object=False)236 props = []237 if obj_info:238 for obj_prop in obj_info.keys():239 if not obj_info[obj_prop] or obj_prop == "obj":240 # Don't add object handle to the list241 continue242 props.append(obj_prop)243 return props244 def getobjectproperty(self, window_name, object_name, prop):245 """246 Get object property value.247 @param window_name: Window name to look for, either full name,248 LDTP's name convention, or a Unix glob.249 @type window_name: string250 @param object_name: Object name to look for, either full name,251 LDTP's name convention, or a Unix glob.252 @type object_name: string253 @param prop: property name.254 @type prop: string255 @return: property256 @rtype: string257 """258 try:259 obj_info=self._get_object_map(window_name, object_name,260 wait_for_object=False)261 except atomac._a11y.ErrorInvalidUIElement:262 # During the test, when the window closed and reopened263 # ErrorInvalidUIElement exception will be thrown264 self._windows={}265 # Call the method again, after updating apps266 obj_info=self._get_object_map(window_name, object_name,267 wait_for_object=False)268 if obj_info and prop != "obj" and prop in obj_info:269 if prop == "class":270 # ldtp_class_type are compatible with Linux and Windows class name271 # If defined class name exist return that,272 # else return as it is273 return ldtp_class_type.get(obj_info[prop], obj_info[prop])274 else:275 return obj_info[prop]276 raise LdtpServerException('Unknown property "%s" in %s' % \277 (prop, object_name))278 def getchild(self, window_name, child_name = '', role = '', parent = ''):279 """280 Gets the list of object available in the window, which matches281 component name or role name or both.282 @param window_name: Window name to look for, either full name,283 LDTP's name convention, or a Unix glob.284 @type window_name: string285 @param child_name: Child name to search for.286 @type child_name: string287 @param role: role name to search for, or an empty string for wildcard.288 @type role: string289 @param parent: parent name to search for, or an empty string for wildcard.290 @type role: string291 @return: list of matched children names292 @rtype: list293 """294 matches = []295 if role:296 role = re.sub(' ', '_', role)297 self._windows={}298 if parent and (child_name or role):299 _window_handle, _window_name = \300 self._get_window_handle(window_name)[0:2]301 if not _window_handle:302 raise LdtpServerException('Unable to find window "%s"' % \303 window_name)304 appmap = self._get_appmap(_window_handle, _window_name)305 obj = self._get_object_map(window_name, parent)306 def _get_all_children_under_obj(obj, child_list):307 if role and obj['class'] == role:308 child_list.append(obj['label'])309 elif child_name and self._match_name_to_appmap(child_name, obj):310 child_list.append(obj['label'])311 if obj:312 children = obj['children']313 if not children:314 return child_list315 for child in children.split():316 return _get_all_children_under_obj( \317 appmap[child],318 child_list)319 matches = _get_all_children_under_obj(obj, [])...

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