How to use _getLocalizedName method in pyatom

Best Python code snippet using pyatom_python

AXClasses.py

Source:AXClasses.py Github

copy

Full Screen

...685 ra = AppKit.NSRunningApplication686 app = ra.runningApplicationWithProcessIdentifier_(687 self._getPid())688 return app.bundleIdentifier()689 def _getLocalizedName(self):690 """Return the localized name of the application."""691 return self._getApplication().AXTitle692 def __getattr__(self, name):693 """Handle attribute requests in several ways:694 1. If it starts with AX, it is probably an a11y attribute. Pass695 it to the handler in _a11y which will determine that for sure.696 2. See if the attribute is an action which can be invoked on the697 UIElement. If so, return a function that will invoke the attribute.698 """699 if name.startswith('AX'):700 try:701 attr = self._getAttribute(name)702 return attr703 except AttributeError:704 pass705 # Populate the list of callable actions:706 actions = []707 try:708 actions = self._getActions()709 except Exception:710 pass711 if name.startswith('AX') and (name[2:] in actions):712 errStr = 'Actions on an object should be called without AX ' \713 'prepended'714 raise AttributeError(errStr)715 if name in actions:716 def performSpecifiedAction():717 # activate the app before performing the specified action718 self._activate()719 return self._performAction(name)720 return performSpecifiedAction721 else:722 raise AttributeError('Object %s has no attribute %s' % (self, name))723 def __setattr__(self, name, value):724 """Set attributes on the object."""725 if name.startswith('AX'):726 return self._setAttribute(name, value)727 else:728 _a11y.AXUIElement.__setattr__(self, name, value)729 def __repr__(self):730 """Build a descriptive string for UIElements."""731 title = repr('')732 role = '<No role!>'733 c = repr(self.__class__).partition('<class \'')[-1].rpartition('\'>')[0]734 try:735 title = repr(self.AXTitle)736 except Exception:737 try:738 title = repr(self.AXValue)739 except Exception:740 try:741 title = repr(self.AXRoleDescription)742 except Exception:743 pass744 try:745 role = self.AXRole746 except Exception:747 pass748 if len(title) > 20:749 title = title[:20] + '...\''750 return '<%s %s %s>' % (c, role, title)751class NativeUIElement(BaseAXUIElement):752 """NativeUIElement class - expose the accessibility API in the simplest,753 most natural way possible.754 """755 def getAttributes(self):756 """Get a list of the attributes available on the element."""757 return self._getAttributes()758 def getActions(self):759 """Return a list of the actions available on the element."""760 return self._getActions()761 def setString(self, attribute, string):762 """Set the specified attribute to the specified string."""763 return self._setString(attribute, string)764 def findFirst(self, **kwargs):765 """Return the first object that matches the criteria."""766 return self._findFirst(**kwargs)767 def findFirstR(self, **kwargs):768 """Search recursively for the first object that matches the769 criteria.770 """771 return self._findFirstR(**kwargs)772 def findAll(self, **kwargs):773 """Return a list of all children that match the specified criteria."""774 return self._findAll(**kwargs)775 def findAllR(self, **kwargs):776 """Return a list of all children (recursively) that match777 the specified criteria.778 """779 return self._findAllR(**kwargs)780 def getElementAtPosition(self, coord):781 """Return the AXUIElement at the given coordinates.782 If self is behind other windows, this function will return self.783 """784 return self._getElementAtPosition(float(coord[0]), float(coord[1]))785 def activate(self):786 """Activate the application (bringing menus and windows forward)"""787 return self._activate()788 def getApplication(self):789 """Get the base application UIElement.790 If the UIElement is a child of the application, it will try791 to get the AXParent until it reaches the top application level792 element.793 """794 return self._getApplication()795 def menuItem(self, *args):796 """Return the specified menu item.797 Example - refer to items by name:798 app.menuItem('File', 'New').Press()799 app.menuItem('Edit', 'Insert', 'Line Break').Press()800 Refer to items by index:801 app.menuitem(1, 0).Press()802 Refer to items by mix-n-match:803 app.menuitem(1, 'About TextEdit').Press()804 """805 menuitem = self._getApplication().AXMenuBar806 return self._menuItem(menuitem, *args)807 def popUpItem(self, *args):808 """Return the specified item in a pop up menu."""809 self.Press()810 time.sleep(.5)811 return self._menuItem(self, *args)812 def getBundleId(self):813 """Return the bundle ID of the application."""814 return self._getBundleId()815 def getLocalizedName(self):816 """Return the localized name of the application."""817 return self._getLocalizedName()818 def sendKey(self, keychr):819 """Send one character with no modifiers."""820 return self._sendKey(keychr)821 def sendGlobalKey(self, keychr):822 """Send one character without modifiers to the system.823 It will not send an event directly to the application, system will824 dispatch it to the window which has keyboard focus.825 Parameters: keychr - Single keyboard character which will be sent.826 """827 return self._sendKey(keychr, globally=True)828 def sendKeys(self, keystr):829 """Send a series of characters with no modifiers."""830 return self._sendKeys(keystr)831 def pressModifiers(self, modifiers):...

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