In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to use the python appium module to develop a small assistant that automatically collects energy. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Introduction
Today, I will teach you to plant trees! You still remember the ant forest horn, you can plant trees on your mobile phone easily!
Text
This article is based on the appium module development of automatic energy collection assistant!
The parameters are configured as follows:
Desired_caps = {"platformName": "Android", # system "platformVersion": "8.0.0", # system version number "deviceName": "M5s", # device name "appPackage": "com.eg.android.AlipayGphone", # package name "appActivity": "AlipayLogin", # app startup main Activity 'noReset': True # retains session information to avoid re-login}
Link to the phone to collect energy:
Def collect_energy (driver): print ('start collecting energy') # get the width and height of the phone screen width = int (driver.get_window_size () ['width']) height = int (driver.get_window_size () [' height']) # the possible regional coordinates of the energy ball start_x = 110 end_x = 940 start_y = 460 end_y = 880 for i in range (start_y, end_y 80): for j in range (start_x, end_x, 80): tap_x1 = int ((int (j) / width) * width) tap_y1 = int ((int (I) / height) * height) # Click to specify the coordinates driver.tap ([(tap_x1, tap_y1), (tap_x1, tap_y1)] 1000) print ('energy collection is complete')
Automatically click on friend energy collection:
Def search_energy (driver): print ('find energy, collect friend energy') time.sleep (3) # Click to find energy driver.tap ([(1000, 1520), (1080, 1580)], 1000) time.sleep (3) # collect friend energy collect_energy (driver) time.sleep (3) # continue to find energy search_energy (driver)
Start performing scheduled tasks:
Def collect_main (): print ('start scheduled task') driver = webdriver.Remote ('http://localhost:4723/wd/hub', Desired_caps) time.sleep (15) # enter your own ant forest driver.find_elements_by_id ('com.alipay.android.phone.openplatform:id/home_app_view') [10] .click () time.sleep (5) collect_energy (driver) search_energy (driver) if _ _ name__ =' _ main__': scheduler = BlockingScheduler () # collect_main: timed execution The method scheduler.add_job (collect_main) 'cron', hour=20, minute=23, second=20) try: scheduler.start () except (KeyboardInterrupt, SystemExit): pass
The effect is as follows:
Gather sand into a tower, wood for the forest, everyone starts from the little things in life, tens of thousands of people's every move together, can make the environment, make the earth better and better!
Your support is my biggest motivation!
On how to use the python appium module to develop an automatic energy collection assistant to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 225
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.