How to use wait_activity method in robotframework-appiumlibrary

Best Python code snippet using robotframework-appiumlibrary_python

android.py

Source: android.py Github

copy

Full Screen

...124 if wait_activity:125 self.driver.start_activity(package, activity, app_wait_activity=wait_activity)126 else:127 self.driver.start_activity(package, activity)128 self.driver.wait_activity(activity, timeout=30)129 def reopen_app(self, package, activity=None, wait_activity=None):130 self.close_app(package)131 self.wait(1)132 self.open_app(package, activity=activity, wait_activity=wait_activity)133 def close_app(self, package: str = None):134 cmd = 'adb -s %s shell am force-stop %s' % (self.udid, package)...

Full Screen

Full Screen

antutu.py

Source: antutu.py Github

copy

Full Screen

...22def antutu_start():23 printf('antutu_start')24 if driver.is_app_installed('com.antutu.ABenchMark'):25 driver.start_activity('com.antutu.ABenchMark','.ABenchMarkStart')26 if driver.wait_activity('com.antutu.benchmark.activity.MainActivity',10):27 return True28 else:29 return False30 else:31 #TODO:install aututu app32 printf('Not install aututu App')33def antutu_setup():34 printf("antutu_setup")35 if layout_content_find_text(driver,'开始测试') != None:36 printf('Finding 开始测试...')37 els = layout_content_find_text(driver,'开始测试')38 if els:39 select_by_text(driver,'开始测试')40 return True41 elif layout_content_find_text(driver,'安装测试') != None:42 printf('安装测试...')43 select_by_text(driver,'安装测试')44 els = layout_content_find_text(driver,'下载中')45 if els:46 els.click()47 if driver.wait_activity('.ui.PackageInstallerActivity',200):48 select_by_text(driver,'安装')49 if driver.wait_activity('.ui.InstallAppProgress'):50 select_by_text(driver,'完成')51 if driver.wait_activity('com.antutu.benchmark.activity.MainActivity',100) == False:52 return False53 else:54 return True55 else:56 return False57 else:58 return False59 else:60 return False61 else:62 printf('Finding 重新测试...')63 pos = find_object_by_image(driver,"image/​retest.png")64 if(pos):65 tap_by_position(driver,pos)66 return True67 else:68 printf('Not found 开始测试')69 return False70def antutu_3dtest():71 printf('antutu_3dtest')72 while True:73 if driver.wait_activity('.UnityPlayerActivity',3) == False:74 return True75def antutu_scoretest():76 printf('antutu_scoretest')77 while True:78 if driver.wait_activity('com.antutu.benchmark.activity.ScoreBenchActivity',3) == False:79 return True80def antutu_resulttest():81 printf('antutu_resulttest')82 if driver.wait_activity('com.antutu.benchmark.activity.TestResultActivity',300):83 print_layout_text(driver)84 driver.press_keycode(4)85 return True86 else:87 return False88method_key = {'com.antutu.benchmark.activity.MainActivity' : antutu_setup, '.UnityPlayerActivity' : antutu_3dtest,89 'com.antutu.benchmark.activity.ScoreBenchActivity' : antutu_scoretest,90 'com.antutu.benchmark.activity.TestResultActivity' : antutu_resulttest}91def run_antutu_method():92 method_key[driver.current_activity]()93def antutu_test():94 if antutu_start():95 while True:96 run_antutu_method()...

Full Screen

Full Screen

weChatApp.py

Source: weChatApp.py Github

copy

Full Screen

...21 driver = webdriver.Remote('http:/​/​127.0.0.1:4723/​wd/​hub', desired_caps)22 # 设置隐形等待时间,单位s23 driver.implicitly_wait(10)24 # 等待微信首页打开25 driver.wait_activity('.ui.LauncherUI', 10)26 time.sleep(2)27 # 获取屏幕尺寸28 screem = driver.get_window_size()29 print(screem)30 # 下拉屏幕,打开微信小程序页面31 driver.swipe(screem['width'] * 0.5, screem['width'] * 0.5,32 screem['height'] * 0.2, screem['height'] * 0.8, 1000)33 # 点击量产云平台小程序34 mpcloudBtn = driver.find_element_by_id('com.tencent.mm:id/​jq')35 mpcloudBtn.click()36 # 等待量产云平台小程序打开37 driver.wait_activity('.plugin.appbrand.ui.AppBrandUI', 10)38 time.sleep(2)39 # 点击数据统计40 dataBtn = driver.find_element_by_xpath('/​/​*[@text="数据统计"]')41 dataBtn.click()42 # 点击返回43 backBtn = driver.find_element_by_xpath('/​/​*[@text="功能"]')44 backBtn.click()45 # 等待页面刷新46 driver.wait_activity('.plugin.appbrand.ui.AppBrandUI', 10)47 time.sleep(2)48 # 点击消息管理49 infoBtn = driver.find_element_by_xpath('/​/​*[@text="消息管理"]')50 infoBtn.click()51 # 等待页面刷新52 driver.wait_activity('.plugin.appbrand.ui.AppBrandUI', 10)53 time.sleep(2)54 # 关闭小程序55 closeBtn = driver.find_element_by_accessibility_id('关闭')56 closeBtn.click()57 # 等待返回微信首页58 driver.wait_activity('.ui.LauncherUI', 10)59 time.sleep(2)60 driver.quit()61if __name__ == "__main__":...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Assessing Risks in the Scrum Framework

Software Risk Management (SRM) combines a set of tools, processes, and methods for managing risks in the software development lifecycle. In SRM, we want to make informed decisions about what can go wrong at various levels within a company (e.g., business, project, and software related).

Dec’22 Updates: The All-New LT Browser 2.0, XCUI App Automation with HyperExecute, And More!

Greetings folks! With the new year finally upon us, we’re excited to announce a collection of brand-new product updates. At LambdaTest, we strive to provide you with a comprehensive test orchestration and execution platform to ensure the ultimate web and mobile experience.

How To Create Custom Menus with CSS Select

When it comes to UI components, there are two versatile methods that we can use to build it for your website: either we can use prebuilt components from a well-known library or framework, or we can develop our UI components from scratch.

How To Automate Toggle Buttons In Selenium Java

If you pay close attention, you’ll notice that toggle switches are all around us because lots of things have two simple states: either ON or OFF (in binary 1 or 0).

Introducing LambdaTest Analytics: Test Reporting Made Awesome ????

Collecting and examining data from multiple sources can be a tedious process. The digital world is constantly evolving. To stay competitive in this fast-paced environment, businesses must frequently test their products and services. While it’s easy to collect raw data from multiple sources, it’s far more complex to interpret it properly.

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 robotframework-appiumlibrary 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