Exemplo n.º 1
0
 def __init__(self):
     super().__init__()
     logging.info('@ Start Auto Refresh Service ... ')
     fu = FileUtils()
     self.config = fu.load_yaml('od_config.yaml')['order']
     self.app = atomacos.getAppRefByBundleId(self.config['appId'])
     self.window = self.app.windows()[0]
     self.button = self.window.buttons(self.config['defaultCheckBoxTitle'])[0]
Exemplo n.º 2
0
    def get_ui_elements(self):
        """
        Get the some interesting UI element references, and save them to the instance variables.

        :return: None
        """
        debug('Getting the UI element references.')
        calculator = atomacos.getAppRefByBundleId('com.apple.calculator')
        calc_window = calculator.AXMainWindow
        ns_box = calc_window.AXChildren[0]
    
        self.calc_box = calc_window.AXChildren[1]
        self.main_display = ns_box.AXChildren[0]
        
        self.button_clear = self.get_button(LABEL_CLEAR)
        self.button_add = self.get_button(LABEL_ADD)
        self.button_substract = self.get_button(LABEL_SUBSTRACT)
        self.button_multiply = self.get_button(LABEL_MULTIPLY)
        self.button_divide = self.get_button(LABEL_DIVIDE)
        self.button_equals = self.get_button(LABEL_EQUALS)
        self.button_negate = self.get_button(LABEL_NEGATE)
        info('Succeeded to get the UI element references.')
 def activate(self):
     atomacos.launchAppByBundleId(self.config['appId'])
     app = atomacos.getAppRefByBundleId(self.config['appId'])
     return app
Exemplo n.º 4
0
# PyAtom Library import
import atomacos
# 계산기 어플을 bundle id를 통해서 실행하
atomacos.launchAppByBundleId('com.apple.calculator')

# 실행된 계산기 어플 Bundle id를 통해서 찾고 객체화하기
calculator = atomacos.getAppRefByBundleId('com.apple.calculator')

try:
    # 만약 계산기 앱이 정상수행되지 않을 경우 AXTitle 값이 객체에 없게 된다.
    getattr(calculator, 'AXTitle')
except:
    # 이럴경우 Exception이 발생하는데 발생하면 3초를 대기한 후 다음동작을 수행하도록 한다.
    import time
    time.sleep(3)
    calculator = atomacos.getAppRefByBundleId('com.apple.calculator')

# 정상적으로 객체 정보가 반영되었는지 확인
print(calculator)

# AXRole이 AXButton이고 AXTitle이 1인 값 찾기
one_button = calculator.findFirstR(AXRole='AXButton', AXTitle='1')
# 1버튼 속성값 확인하기
print(one_button.getActions())
# 1버튼 클릭하기
one_button.Press()

Exemplo n.º 5
0
def getSXT():
    sxt = atomacos.getAppRefByBundleId("org.surge-synth-team.surge-xt")
    return sxt
Exemplo n.º 6
0
def test_bad_bundle_id():
    with pytest.raises(ValueError):
        atomacos.getAppRefByBundleId("bad.bundle.id")
Exemplo n.º 7
0
def test_get_app_by_bundle_id(finder_app):
    bid = finder_app.getBundleId()
    bybid = atomacos.getAppRefByBundleId(bid)
    assert bybid == finder_app
Exemplo n.º 8
0
 def activate(self):
     atomacos.launchAppByBundleId(self.config['appId'])
     app = atomacos.getAppRefByBundleId(self.config['appId'])
     window = app.windows()[0]
     return app, window