atomacos package

Automated Testing on macOS

Submodules

atomacos.AXCallbacks module

atomacos.AXCallbacks.match_filter(**kwargs)

atomacos.AXClasses module

class atomacos.AXClasses.NativeUIElement(ref=None)

Bases: atomacos._mixin._input.KeyboardMouseMixin, atomacos._mixin._wait.WaitForMixin, atomacos._mixin._search.SearchMethodsMixin, atomacos._a11y.AXUIElement

NativeUIElement class - expose the accessibility API in the simplest, most natural way possible.

activate()

Activate the application (bringing menus and windows forward)

getActions()

Return a list of the actions available on the element.

classmethod getAnyAppWithWindow()

Get a random app that has windows.

Raise a ValueError exception if no GUI applications are found.

classmethod getAppRefByBundleId(bundleId)

Get the top level element for the application with the specified bundle ID, such as com.vmware.fusion.

classmethod getAppRefByLocalizedName(name)

Get the top level element for the application with the specified localized name, such as VMware Fusion.

Wildcards are also allowed.

classmethod getAppRefByPid(pid)

Get the top level element for the application specified by pid.

getApplication()

Get the base application UIElement.

If the UIElement is a child of the application, it will try to get the AXParent until it reaches the top application level element.

getAttributes()

Get a list of the attributes available on the element.

getBundleId()

Return the bundle ID of the application.

getElementAtPosition(coord)

Return the AXUIElement at the given coordinates.

If self is behind other windows, this function will return self.

classmethod getFrontmostApp()

Get the current frontmost application.

Raise a ValueError exception if no GUI applications are found.

getLocalizedName()

Return the localized name of the application.

classmethod getRunningApps()

Get a list of the running applications.

classmethod getSystemObject()

Get the top level system accessibility object.

static launchAppByBundleId(bundleID)

Launch the application with the specified bundle ID

static launchAppByBundlePath(bundlePath, arguments=None)

Launch app with a given bundle path.

Return True if succeed.

menuItem(*args)

Return the specified menu item.

Example - refer to items by name:

app.menuItem(‘File’, ‘New’).Press() app.menuItem(‘Edit’, ‘Insert’, ‘Line Break’).Press()

Refer to items by index:

app.menuitem(1, 0).Press()

Refer to items by mix-n-match:

app.menuitem(1, ‘About TextEdit’).Press()

popUpItem(*args)

Return the specified item in a pop up menu.

setString(attribute, string)

Set the specified attribute to the specified string.

classmethod setSystemWideTimeout(timeout=0.0)

Set the system-wide accessibility timeout.

Parameters

timeout – non-negative float. 0 will reset to the system default.

Returns

None

setTimeout(timeout=0.0)

Set the accessibiltiy API timeout on the given reference.

Parameters

timeout – A value of 0 will reset the timeout to the systemwide value

classmethod set_systemwide_timeout(timeout=0.0)

Set the system-wide accessibility timeout.

Parameters

timeout – A value of 0 will reset the timeout to the system default.

static terminateAppByBundleId(bundleID)

Terminate app with a given bundle ID. Requires 10.6.

Return True if succeed.

atomacos.errors module

exception atomacos.errors.AXError

Bases: Exception

exception atomacos.errors.AXErrorAPIDisabled

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorActionUnsupported

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorAttributeUnsupported

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorCannotComplete

Bases: atomacos.errors.AXError

atomacos.errors.AXErrorFactory(code)
exception atomacos.errors.AXErrorFailure

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorIllegalArgument

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorInvalidUIElement

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorInvalidUIElementObserver

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorNoValue

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorNotImplemented

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorNotificationAlreadyRegistered

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorNotificationNotRegistered

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorNotificationUnsupported

Bases: atomacos.errors.AXError

exception atomacos.errors.AXErrorUnsupported

Bases: atomacos.errors.AXError

atomacos.errors.check_ax_error(error_code, error_messages)

Returns if code is kAXErrorSuccess. Raises an error with given message based on given error code. Defaults to AXErrorUnsupported for unknown codes.

Parameters
  • error_code – the error code

  • error_messages – mapping from error code to error message

atomacos.keyboard module

keyboard api from pyautogui

atomacos.mouse module

mouse api from pyautogui