“This is the 10th day of my participation in the First Challenge 2022. For details: First Challenge 2022”

Curriculum background

  • It’s almost the end of the year and I’ve got a lot on my plate and nothing to do with it
  • The Nuggets are getting more rewarding againA little joy
  • But the last time I wrote 50 technical documents by hand I felt so hollowed out that I had nothing left to write about
  • I’d like to share a little skill called auto-.js that I got earlier

The text start

As we analyzed in the previous chapter, we need to use the ID selector to select elements. Let’s continue where we left off.

1 ID selector The id(“”) parameter can be either ID or fulLID, which can be selected to the response element

2 Open a chat dialog box based on the unread message

// Look for unread messages
let un_read = id("com.tencent.mobileqq:id/unreadmsg").findOne(1000)
if(un_read){
    // Click the unread message button according to the coordinates
    click(un_read.bounds().centerX()-200,un_read.bounds().centerY())
    liiy_sleep(1)}Copy the code

** Warning ** Because the unread button the small red circle will only zoom in and will not open the chat window. So we subtracted a number from the X-axis. This ensures that the message gets clicked.

After the completion of the operation came to the chat dialog box. The red envelope is on it

3 Analyze the layout of the red envelope and get the red envelope

We check the layout of the red envelopes

Analysis found desc as our possible selector. But it seems that if the text is not gongxi Facai what can not get.

What elements determine the presence of a red envelope on the current page is a question we need to consider. This requires analyzing the layout of each section to find out which elements can be marked as red packets.