How to use getAppRefByBundleId method in pyatom

Best Python code snippet using pyatom_python

automateMac.py

Source:automateMac.py Github

copy

Full Screen

...90 graphlist.reverse()91 92 return graphlist93 def get_appref(bundleid):94 instrument = atomac.getAppRefByBundleId(bundleid)95 return instrument96 97 98 # 开始instruments记录99 def start_record():100 # atomac.launchAppByBundleId("com.apple.dt.Instruments")101 # time.sleep(2)102 instrument = atomac.getAppRefByBundleId("com.apple.dt.Instruments")103 recordbutton = instrument.windows()[0].toolbars()[0].checkboxs()[0]104 recordbutton.Press()105 return instrument106 107 108 # 停止记录109 def stop_record():110 start_record()111 112 113# windows上安装atomac失败,便于调试其他函数114else:115 def start_record():116 pass117 def stop_record():118 pass119 def get_systeminfo(instrument, appname):120 return ['1','2','3']121 def get_graphinfo(instrument):122 return [['1','2','3']]123 def get_appref(bundleid):124 pass125 def jump_page(a, b):126 pass127 128if __name__ == "__main__":129 #print(get_graphinfo("aa"))130 instrument = atomac.getAppRefByBundleId("com.apple.dt.Instruments")131 print(get_systeminfo(instrument, "test"))132 ...

Full Screen

Full Screen

calculator_sample.py

Source:calculator_sample.py Github

copy

Full Screen

2import atomacos3# 계산기 어플을 bundle id를 통해서 실행하4atomacos.launchAppByBundleId('com.apple.calculator')5# 실행된 계산기 어플 Bundle id를 통해서 찾고 객체화하기6calculator = atomacos.getAppRefByBundleId('com.apple.calculator')7try:8 # 만약 계산기 앱이 정상수행되지 않을 경우 AXTitle 값이 객체에 없게 된다.9 getattr(calculator, 'AXTitle')10except:11 # 이럴경우 Exception이 발생하는데 발생하면 3초를 대기한 후 다음동작을 수행하도록 한다.12 import time13 time.sleep(3)14 calculator = atomacos.getAppRefByBundleId('com.apple.calculator')15# 정상적으로 객체 정보가 반영되었는지 확인16print(calculator)17# AXRole이 AXButton이고 AXTitle이 1인 값 찾기18one_button = calculator.findFirstR(AXRole='AXButton', AXTitle='1')19# 1버튼 속성값 확인하기20print(one_button.getActions())21# 1버튼 클릭하기...

Full Screen

Full Screen

atomac-test.py

Source:atomac-test.py Github

copy

Full Screen

1import atomac2import time3atomac.launchAppByBundleId('com.apple.calculator')4calc = atomac.getAppRefByBundleId('com.apple.calculator')5time.sleep(2)6window = calc.windows()[0]7print window8print window.AXTitle9print window.getAttributes()10print window.getActions()11print window.AXIdentifier12print window.AXChildren13print window.buttons()14window.sendKeys ("234*2")15widget = window.findFirstR(AXIdentifier='_NS:98')16print widget17# atomac.launchAppByBundleId('com.apple.Automator')18# automator = atomac.getAppRefByBundleId('com.apple.Automator')19# print automator.windows()20# window = automator.windows()[0]21# print window.AXTitle22# print window.getAttributes()23# print window.AXIdentifier24# print window.sheets()25# #print window.AXChildren26# sheet = window.sheets()[0]27# print sheet28# print sheet.AXIdentifier29# #print sheet.AXTitle30# print sheet.AXChildren31# print sheet.buttons()32# close = sheet.buttons('Close')[0]...

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