In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
What this article shares with you is about how to realize interface automation in WeChat Mini Programs. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it with the editor.
Environmental preparation
A windows or mac computer
Wechat developer tools
A WeChat account and the rights of Mini Program developer.
The code of Mini Program
Principle
Python uses minium,JS to use miniprogram-automator, which is the UI automated testing tool provided officially by Wechat. Their principle is to call up Wechat developer tools, and then provide a port for automated testing, and then their API should all communicate with this port.
I use miniprogram-automator, and the following is explained in miniprogram-automator, and then you can use the method of miniProgram.callWxMethod to call wx.login () to get code, which is the way to get code.
Realize
I wrote a service and exposed an http://127.0.0.1:3000/wxlogin?appid=xxxxxxxxxxxx,. The API needs to pass a parameter of Mini Program's appid, and then there is a config.js to configure appid and Mini Program's absolute project path (Note: the code obtained by one Mini Program cannot be logged in another Mini Program, code should be associated with appid)
Find the Mini Program project path through the appid, call the automator.launch () method, start the Wechat developer tool, then call miniProgram.callWxMethod () to call the wx.login () method to get the code, and finally return the code from the interface I provided
When each Mini Program requests any API, you need to call the API provided by me to obtain the code login and then make subsequent request operations.
Pay attention
Do not request your own interface concurrently! Do not request your own interface concurrently! Do not request your own interface concurrently! Because this solution needs to call up Wechat developer tools, if it is adjusted concurrently, it will rout the Wechat developer tools. I started with more than 10 Mini Program calling my own interfaces at the same time, and then broke the Wechat developer tools. So I have serial requests for WeChat Mini Programs's interface use cases.
The response speed of the API http://127.0.0.1:3000/wxlogin?appid=xxxxxxxxxxxx is relatively slow because you need to call Wechat developer tools and then obtain code.
Wechat developer tools need to log in in advance
Cannot be deployed in linux because the Wechat developer tool does not have a linux version
The above is how to achieve interface automation in WeChat Mini Programs. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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: 0
*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.