WeChat built-in browser debugging mode

0. Foreword The
  latest project is to implement the function of canvassing and grabbing tickets based on the public account. Due to the relatively large limit of WeChat, it is difficult to view the web page code of the public account, but it is difficult to analyze API requests just by capturing packets. So look at the information to see if there is a way to debug the public account. Then found that there is a devtools development debugging plug-in.

1. View the built-in browser version

  Just build a web server, write a page

1 <html>
2     <script type="text/javascript">
3         window.open("chrome://version")
4     </script>
5 </html>


  Seeing the path behind --resources-dir-path is what you need to use later.

 

2. Download devtools_resources.pak
  Due to the difference in versions, you need to download the corresponding version of devtools_resources.pak (there is a download link at the bottom). Then put devtools_resources.pak in the --resources-dir-path directory above

3. Configure WeChat startup parameters
  in WeChat shortcut, right-click properties, add -remote-debugging-port = 8000 behind the target to

  restart WeChat and log in. You can visit http://127.0.0.1:8000/json
  for advanced usage of CEF, you need to refer to the official documentation to test. Not expanded here. Since the PC version of WeChat has a built-in browser, which is a revision of Chrome's shell, most of the functions supported by Google Chrome CEF are also supported by WeChat.

 

4. Public  account view
Just open a public account (12306), and then right-click to open DevTool. The rest is exactly the same as pressing the F12 in the normal browser to enter the debugging mode. You can write scripts casually.

 

   Some people may say that the above demo, after directly copying, just open it in the browser. That's because you haven't seen it, some public account needs to be opened in WeChat browser.

 

Reference materials: https://juejin.im/post/5e60c5556fb9a07cc7474b04
  

Devtools download:

  https://files.cnblogs.com/files/wunaozai/devtools_resources.zip

This paper address: https://www.cnblogs.com/wunaozai/p/12672124.html
Personal homepage: https://www.wunaozai.com/

Guess you like

Origin www.cnblogs.com/wunaozai/p/12672124.html