How to use _generateChildrenR method in pyatom

Best Python code snippet using pyatom_python

AXClasses.py

Source:AXClasses.py Github

copy

Full Screen

...560 return561 if children:562 for child in children:563 yield child564 def _generateChildrenR(self, target=None):565 """Generator which recursively yields all AXChildren of the object."""566 if target is None:567 target = self568 try:569 children = target.AXChildren570 except _a11y.Error:571 return572 if children:573 for child in children:574 yield child575 for c in self._generateChildrenR(child):576 yield c577 def _match(self, **kwargs):578 """Method which indicates if the object matches specified criteria.579 Match accepts criteria as kwargs and looks them up on attributes.580 Actual matching is performed with fnmatch, so shell-like wildcards581 work within match strings. Examples:582 obj._match(AXTitle='Terminal*')583 obj._match(AXRole='TextField', AXRoleDescription='search text field')584 """585 for k in kwargs.keys():586 try:587 val = getattr(self, k)588 except _a11y.Error:589 return False590 # Not all values may be strings (e.g. size, position)591 if isinstance(val, str):592 if not fnmatch.fnmatch(val, kwargs[k]):593 return False594 else:595 if val != kwargs[k]:596 return False597 return True598 def _matchOther(self, obj, **kwargs):599 """Perform _match but on another object, not self."""600 if obj is not None:601 # Need to check that the returned UI element wasn't destroyed first:602 if self._findFirstR(**kwargs):603 return obj._match(**kwargs)604 return False605 def _generateFind(self, **kwargs):606 """Generator which yields matches on AXChildren."""607 for needle in self._generateChildren():608 if needle._match(**kwargs):609 yield needle610 def _generateFindR(self, **kwargs):611 """Generator which yields matches on AXChildren and their children."""612 for needle in self._generateChildrenR():613 if needle._match(**kwargs):614 yield needle615 def _findAll(self, **kwargs):616 """Return a list of all children that match the specified criteria."""617 result = []618 for item in self._generateFind(**kwargs):619 result.append(item)620 return result621 def _findAllR(self, **kwargs):622 """Return a list of all children (recursively) that match the specified623 criteria.624 """625 result = []626 for item in self._generateFindR(**kwargs):...

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