When simulating the WeChat interface, prompt “Please open the link in WeChat client” (turn)

Background description

Share picture

I believe that all tests that simulate WeChat page requests have seen this page. To put it simply, a crawler crawls the WeChat page , This page will appear during playback. About 1 year ago, a person was specially arranged to solve this technical problem. Unfortunately, no solution was found at that time. All subsequent interface tests and performance tests on the WeChat terminal could not be carried out. Today, I will share our solution with you. I hope everyone can bypass the WeChat pit.

Business scenario

I use JMeter as an example here. We can enable the proxy on JMeter and set the proxy on the mobile phone. To record the request on the WeChat side, the following is the script generated for the business on the WeChat side:

Share a picture

After the recording is complete, We will replay, and you will find that in the View Results Tree, you will be redirected to WeChat Authorization, and then you will start to prompt: Please open the link on the WeChat client.

share picture

Here are some tips for recording

share picture

1. Put a new controller in each group: generated by an operation on the mobile phone The request will be placed in a controller, which is very convenient;
2, select record HTTP header, add assertion, Regex matching: automatically add header and assertion;

Problem analysis

Here we look at the code corresponding to the page Please open the link on the WeChat client: