How to use _match_name_to_appmap method in pyatom

Best Python code snippet using pyatom_python

core.py

Source:core.py Github

copy

Full Screen

...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, [])320 if not matches:321 if child_name:322 _name = 'name "%s" ' % child_name323 if role:324 _role = 'role "%s" ' % role325 if parent:326 _parent = 'parent "%s"' % parent327 exception = 'Could not find a child %s%s%s' % (_name, _role, _parent)328 raise LdtpServerException(exception)329 return matches330 _window_handle, _window_name = \331 self._get_window_handle(window_name)[0:2]332 if not _window_handle:333 raise LdtpServerException('Unable to find window "%s"' % \334 window_name)335 appmap = self._get_appmap(_window_handle, _window_name)336 for name in appmap.keys():337 obj = appmap[name]338 # When only role arg is passed339 if role and not child_name and obj['class'] == role:340 matches.append(name)341 # When parent and child_name arg is passed342 if parent and child_name and not role and \343 self._match_name_to_appmap(parent, obj):344 matches.append(name)345 # When only child_name arg is passed346 if child_name and not role and \347 self._match_name_to_appmap(child_name, obj):348 return name349 matches.append(name)350 # When role and child_name args are passed351 if role and child_name and obj['class'] == role and \352 self._match_name_to_appmap(child_name, obj):353 matches.append(name)354 if not matches:355 _name = ''356 _role = ''357 _parent = ''358 if child_name:359 _name = 'name "%s" ' % child_name360 if role:361 _role = 'role "%s" ' % role362 if parent:363 _parent = 'parent "%s"' % parent364 exception = 'Could not find a child %s%s%s' % (_name, _role, _parent)365 raise LdtpServerException(exception)366 return matches...

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