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:

How Testers Can Remain Valuable in Agile Teams

Traditional software testers must step up if they want to remain relevant in the Agile environment. Agile will most probably continue to be the leading form of the software development process in the coming years.

An Interactive Guide To CSS Hover Effects

Building a website is all about keeping the user experience in mind. Ultimately, it’s about providing visitors with a mind-blowing experience so they’ll keep coming back. One way to ensure visitors have a great time on your site is to add some eye-catching text or image animations.

What Agile Testing (Actually) Is

So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.

Webinar: Building Selenium Automation Framework [Voices of Community]

Even though several frameworks are available in the market for automation testing, Selenium is one of the most renowned open-source frameworks used by experts due to its numerous features and benefits.

How To Run Cypress Tests In Azure DevOps Pipeline

When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.

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