Account status detection method and device, and electronic device
By simulating user behavior and dynamically generating click locations, the problem of element location failure in account status detection in social applications is solved, achieving highly accurate and reliable account status detection, and is suitable for version compatibility and resolution adaptation in social applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN DIANMAO TECH CO LTD
- Filing Date
- 2026-04-17
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies for detecting account status in social applications suffer from low success rates in element location, scripts becoming prone to failure after version upgrades, and the inability to determine whether a page actually redirects after a click.
By simulating a user's account addition behavior, the social application automatically jumps to the account information interface of the account under test, dynamically generates the current click position, sequentially covers all vertical areas where the control may appear, and judges the interface changes by comparing the optical character recognition results to determine the account status.
It improves the accuracy and reliability of detection, avoids misjudgments caused by environmental interference, has good version compatibility and resolution adaptation capabilities, and significantly improves the accuracy and reliability of detection.
Smart Images

Figure CN122369029A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to methods, devices, and electronic equipment for detecting account status. Background Technology
[0002] In some business models (such as education and training, sales, etc.), employees need to prepare multiple social media accounts to add students, parents, and customers. Adding friends multiple times in a short period of time may trigger the security mechanisms of social media applications, such as making the social media account unsearchable by other users or preventing friend additions. However, employees have no way of knowing whether the current social media account has triggered the security mechanism. Currently, for the status detection of social media accounts, related technologies usually adopt automated solutions based on UI element positioning, using page attributes such as resource-id, xpath, and text to locate page controls for click operations. However, social media applications are generally highly closed applications with self-drawn controls. Their pages do not have stable resource-ids, the xpath structure changes dynamically with the version, and text nodes are also frequently updated, resulting in a very low success rate of element positioning. The script is also prone to failure after version upgrades. In addition, some related technologies use simple script solutions based on fixed coordinate clicks to simulate clicks at preset coordinates. However, due to differences in phone resolution and screen ratio, and the dynamic change in the position of the "Add to Contacts" button on the Add Friends page affected by switches such as "Moments Permissions" and "Notes", the fixed coordinates make it easy to accidentally click on dangerous areas such as "Report" or "Block", and it is impossible to determine whether the page actually redirects after clicking. Summary of the Invention
[0003] This application provides an account status detection method, device, and electronic device to solve the problems of low success rate of element location, easy script failure after version upgrade, and inability to determine whether the page has actually redirected after clicking in related technologies.
[0004] Firstly, this application provides a method for detecting account status, including: In response to the account addition operation, the account information interface for adding the account to be tested is displayed; Determine the current click position in the account information interface; the current click position is determined by subtracting a preset step size from the ordinate of the previous click position; the preset step size is less than the height of the friend adding control in the account information interface; A click operation is performed on the current clicked position to obtain the current optical character recognition result of the current interface, and it is compared with the historical optical character recognition result corresponding to the historical clicked position to determine the degree of difference between the current optical character recognition result and the historical optical character recognition result; If the difference exceeds a preset threshold, the page text is determined based on the current optical character recognition result; Based on the correspondence between the page text and preset keywords, determine the account status of the account to be tested; the account status includes whether it can be added directly, requires verification to add, or is abnormal.
[0005] The account status detection method provided in this embodiment simulates a user's account addition behavior, causing the social application to automatically jump to the account information interface of the account under test, providing an accurate and repeatable operating environment for subsequent clicks and recognition. By generating the current click position sequentially from bottom to top, it ensures that each click position can cover the entire vertical area where the control may appear. Furthermore, since it does not rely on the attributes of controls in the social application or fixed coordinates, it avoids the element positioning failure problem caused by version upgrades and interface changes in social applications, exhibiting good version compatibility and resolution adaptation capabilities. By comparing the optical character recognition results after two clicks, the degree of change in the interface content can be quantified, enabling the determination of whether a substantial interface jump has occurred. This avoids misjudgments caused by environmental interference, significantly improving the accuracy and reliability of detection.
[0006] In some optional implementations, the account status detection method further includes: If the difference is less than or equal to a preset threshold, the next click position is determined by subtracting a preset step size from the ordinate of the current click position, and a click operation is performed on the next click position to obtain the optical character recognition result of the current interface, until the difference corresponding to the optical character recognition result of the current interface is greater than the preset threshold.
[0007] In some optional implementations, the account status detection method further includes: If there is no corresponding previous click position at the current click position, half the width of the account information interface is used as the horizontal coordinate of the current click position, and the height of the account information interface minus the preset step size is used as the vertical coordinate of the current click position. The current click position is determined based on the horizontal and vertical coordinates.
[0008] In some optional implementations, obtaining the current optical character recognition result of the current interface includes: Based on multiple page segmentation modes, optical character recognition processing is performed on the current interface in sequence; If any page segmentation mode returns the corresponding page optical character recognition result, the page optical character recognition result will be used as the current optical character recognition result.
[0009] In some optional implementations, determining the degree of difference between the current optical character recognition result and historical optical character recognition results includes: The current optical character recognition result and the historical optical character recognition result are compared using a distance algorithm to determine the edit distance between the current optical character recognition result and the historical optical character recognition result; The degree of difference is determined based on the edit distance.
[0010] In some optional implementations, in response to an account addition operation, an account information interface for adding a test account is displayed, including: Detect the connection status of the test environment; the connection status includes the emulator status, server status, and social application installation status. Launch the social application in the test environment. In response to the simulated account addition operation, enter the account information interface for adding the account to be tested.
[0011] In some optional implementations, in response to the simulated account addition operation, an account information interface for adding the account to be tested is accessed, including: In response to a simulated click operation to add a contacts control to the main interface of a social application, the add friend interface is displayed; In response to a simulated input operation in the input box of the Add Friend interface, the user enters the account to be tested and enters the account information interface for adding the account to be tested; or, in response to a simulated click operation in the QR code scanning control of the Add Friend interface, the user loads the album of the test environment, selects the QR code corresponding to the account to be tested in the album, and enters the account information interface for adding the account to be tested.
[0012] In some optional implementations, after determining the account status of the account to be tested, the account status detection method further includes: The system will then return to the main interface of the social application and begin testing the next account to be tested.
[0013] The account status detection method provided in this embodiment simulates a user's account addition behavior, causing the social application to automatically jump to the account information interface of the account under test, providing an accurate and repeatable operating environment for subsequent clicks and recognition. By dynamically generating the current click position, it ensures that each click position can cover the entire vertical area where the control may appear. Simultaneously, because it does not rely on the attributes of controls in the social application or fixed coordinates, it avoids the element positioning failure problem caused by version upgrades and interface changes in the social application, exhibiting good version compatibility and resolution adaptation capabilities. By comparing the optical character recognition results after two clicks, the degree of change in the interface content can be quantified, enabling the determination of whether a substantial interface jump has occurred. This avoids misjudgments caused by environmental interference, significantly improving the accuracy and reliability of detection. By sequentially performing optical character recognition processing on the current interface based on multiple page segmentation modes, the most suitable page segmentation mode can be used for different interface layouts, significantly improving the success rate of optical character recognition and avoiding interruptions or misjudgments in the entire detection process due to the failure of a single page segmentation mode, thus improving accuracy.
[0014] Secondly, this application provides an account status detection device, comprising: The information interface module is used to respond to the account addition operation and display the account information interface for adding the account to be tested.
[0015] The click location module is used to determine the current click location within the account information interface. The current click location is determined by subtracting a preset step size from the ordinate of the previous click location. The preset step size is less than the height of the friend-adding control in the account information interface.
[0016] The click operation module is used to perform a click operation on the current click position, obtain the current optical character recognition result of the current interface, and compare it with the historical optical character recognition result corresponding to the historical click position to determine the degree of difference between the current optical character recognition result and the historical optical character recognition result.
[0017] The difference module is used to determine the page text based on the current optical character recognition result when the difference is greater than a preset threshold.
[0018] The status determination module is used to determine the account status of the account to be tested based on the correspondence between the page text and preset keywords. The account status includes: can be added directly, requires verification to add, or the account is abnormal.
[0019] Thirdly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the account status detection method of the first aspect or any corresponding embodiment described above.
[0020] Fourthly, this application provides a computer-readable storage medium storing computer instructions for causing a computer to execute the account status detection method of the first aspect or any corresponding embodiment described above.
[0021] Fifthly, this application provides a computer program product, including computer instructions for causing a computer to execute the account status detection method described in the first aspect or any corresponding embodiment. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this application; Figure 2 This is a schematic diagram of the first type of account status detection method according to an embodiment of this application; Figure 3 This is a schematic diagram of an account information interface according to an embodiment of this application; Figure 4 This is a schematic diagram of the second process of the account status detection method according to the embodiments of this application; Figure 5 This is a structural block diagram of an account status detection device according to an embodiment of this application; Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0026] As one optional application scenario in the embodiments of this application, such as Figure 1 As shown, a social application 101 is installed in the terminal device 110, and the user 130 can interact with the social application 101 through the terminal device 110 and / or the access device of the terminal device 110.
[0027] For example, the social application 101 can be any application that provides a friend-adding service. Figure 1 In the application scenario shown, if the social application 101 is active, the terminal device 110 can display the interface 102 of the social application 101. The interface 102 may include various pages that the social application 101 can provide, such as the add friend interface, the account details interface, etc.
[0028] Terminal device 110 can be a mobile terminal, fixed terminal, or portable terminal, etc., including but not limited to mobile phones, desktop computers, laptop computers, multimedia tablets, or any combination thereof, including accessories and peripherals of these devices, or any combination thereof. It should be noted that... Figure 1 This is merely an example of an application scenario and does not limit the scope of protection of this application.
[0029] The embodiments of this application will be described below with reference to the accompanying drawings. It should be understood that the pages shown in the drawings are merely examples, and various page designs are possible in practice. The various graphic elements on the page may have different arrangements and different visual representations, one or more elements may be omitted or replaced, and one or more other elements may also be present; no limitations are made in the embodiments of this application. Furthermore, the embodiments are mainly described below with reference to terminal device 110. It should be understood that the actions described relative to terminal device 110 can be performed by the social application 101 on terminal device 110.
[0030] This application provides an account status detection method. By simulating a user's account addition behavior, the social application automatically redirects to the account information interface of the account under test, providing an accurate and repeatable operating environment for subsequent clicks and identification. By generating the current click position sequentially from bottom to top, it ensures that each click position can cover the entire vertical area where the control may appear. Furthermore, since it does not rely on the attributes of controls in the social application or fixed coordinates, it avoids the element positioning failure problem caused by version upgrades and interface changes in the social application, exhibiting good version compatibility and resolution adaptation capabilities.
[0031] According to an embodiment of this application, an account status detection method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0032] This embodiment provides an account status detection method, which can be used in the aforementioned terminal devices, such as mobile phones, desktop computers, and laptop computers. Figure 2 This is a flowchart of an account status detection method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps: Step S201: In response to the account addition operation, display the account information interface for adding the account to be tested.
[0033] During automated account detection, the device can control the addition of accounts within social applications. For example, an automated script can simulate clicks to add accounts. After the account addition is performed, the screen displays the account information interface corresponding to the account under test, showing details related to that account. Taking WeChat as an example, the account information interface typically includes an account avatar, nickname, and operation controls, such as "Add to Contacts" (i.e., friend addition control). By simulating the user's account addition behavior, the social application redirects to the account information interface of the account under test, providing the correct operating environment for subsequent clicks and identification.
[0034] Step S202: Determine the current click position in the account information interface. The current click position is determined by subtracting a preset step size from the ordinate of the previous click position. The preset step size is less than the height of the friend adding control in the account information interface.
[0035] Because the actual position of the friend-adding control on the page is not fixed (it may fluctuate due to changes in the number of menu items or differences in screen resolution), traditional fixed-coordinate methods cannot reliably locate it. Therefore, after entering the account information interface, the current click position can be dynamically generated. The current click position can be determined by the previous click position. In this embodiment, the coordinates of the previous click position can be obtained first, and then the x-coordinate of the previous click position can be used as the x-coordinate of the current click position, for example, within a certain range near the midpoint in the middle area of the interface. The y-coordinate of the previous click position is subtracted by a preset step size to obtain the y-coordinate of the current click position, thereby determining the current click position.
[0036] To ensure that the currently selected click position can click the friend-adding control, a preset step size can be set to be less than the height of the friend-adding control. In this embodiment, the preset step size can be determined by the height of the account information interface. For example, a step size parameter can be set such that the preset step size equals the product of the interface height and the step size parameter. For instance, the step size parameter can be 0.01. If the interface height is 1500 pixels, the preset step size can be 15 pixels, i.e., 0.01 × 1500. By moving upwards from the previous click position by a step size smaller than the control's height, the vertical range where the friend-adding control might appear is covered, ensuring that the friend-adding control can be clicked regardless of its location at the bottom.
[0037] Figure 3 This is a schematic diagram of an account information interface according to this embodiment, such as... Figure 3 As shown, the distance between the current click position and the previous click position on the vertical axis is a preset step size. This preset step size must be less than the height of the "Add to Contacts" control (i.e., the friend addition control) to ensure that the friend addition control is clicked by at least one click position. The top-left corner of the interface is the origin of the coordinate system, with its vertical axis (Y-axis) pointing downwards. Therefore, subtracting the preset step size from the vertical axis of the previous click position is equivalent to moving the click position upwards by the distance corresponding to that preset step size.
[0038] Step S203: Perform a click operation on the current click position, obtain the current optical character recognition result of the current interface, and compare it with the historical optical character recognition result corresponding to the historical click position to determine the degree of difference between the current optical character recognition result and the historical optical character recognition result.
[0039] After each click, Optical Character Recognition (OCR) is performed on the current interface to obtain the OCR result. It's important to understand that not every click will result in clicking the "Add Friend" control. Therefore, the current interface could be the interface after clicking the "Add Friend" control (i.e., a page redirect has occurred) or the account information interface before clicking the "Add Friend" control (i.e., no page redirection has occurred, and the page remains unchanged). After determining the OCR result of the current interface, it can be compared with the historical OCR results corresponding to previous click positions. The historical click position could be the previous click position or the first click position on the account information interface. By comparing the current OCR result with the historical OCR results and calculating the degree of difference between them, the extent of change in the interface content can be measured.
[0040] Step S204: If the difference is greater than a preset threshold, determine the page text based on the current optical character recognition result.
[0041] After obtaining the difference score, it can be compared with a preset threshold. The preset threshold is a pre-defined difference score threshold used to determine whether the interface has undergone a substantial change. When the difference score exceeds this threshold, it can be determined that the interface has been redirected. After determining that the interface has been redirected, the current page text can be determined based on the current optical character recognition results for subsequent account status determination.
[0042] By comparing the recognition result with the result after the previous click, it can be determined whether the interface has undergone substantial changes (i.e., whether an interface jump has occurred). If the difference is large, it means that the page has jumped; if the difference is small, it means that the click was invalid or only a minor change has occurred (such as a minor change such as time or battery refresh). Judging based on the difference can avoid misjudgment caused by environmental interference in a single OCR result.
[0043] Step S205: Determine the account status of the account to be tested based on the correspondence between the page text and preset keywords. Account status includes: can be added directly, requires verification to add, or account is abnormal.
[0044] Given the page text, it can be determined whether preset keywords correspond to the page text. Preset keywords are multiple pre-defined sets of keywords used to match the page text to determine the account status. Different keywords correspond to different account status categories. For example, one set of preset keywords might be "send message" or "video call." If this set of keywords appears in the page text, the account under test can be determined to be in a state where it can be directly added. Another set of preset keywords might be "apply to add friend" or "notes." If this set of keywords appears in the page text, it indicates that establishing a friend relationship requires verification, and the account under test can be determined to be in a state where verification is required. The next set of preset keywords might be "user does not exist" or "account abnormal." If this set of keywords appears in the page text, the account under test can be determined to be in an abnormal account state.
[0045] The account status detection method provided in this embodiment simulates a user's account addition behavior, causing the social application to automatically jump to the account information interface of the account under test, providing an accurate and repeatable operating environment for subsequent clicks and recognition. By generating the current click position sequentially from bottom to top, it ensures that each click position can cover the entire vertical area where the control may appear. Furthermore, since it does not rely on the attributes of controls in the social application or fixed coordinates, it avoids the element positioning failure problem caused by version upgrades and interface changes in social applications, exhibiting good version compatibility and resolution adaptation capabilities. By comparing the optical character recognition results after two clicks, the degree of change in the interface content can be quantified, enabling the determination of whether a substantial interface jump has occurred. This avoids misjudgments caused by environmental interference, significantly improving the accuracy and reliability of detection.
[0046] This embodiment provides an account status detection method, which can be used in the aforementioned terminal devices, such as mobile phones, desktop computers, and laptop computers. Figure 4 This is a flowchart of an account status detection method according to an embodiment of this application, such as... Figure 4 As shown, the process includes the following steps: Step S401: In response to the account addition operation, display the account information interface for adding the account to be tested.
[0047] Please see details Figure 1 Step S201 of the illustrated embodiment will not be described again here.
[0048] In some optional implementations, step S401, "in response to the account addition operation, displays an account information interface for adding the account to be tested," includes steps a1 and a2.
[0049] Step a1: Check the connection status of the test environment. The connection status includes the emulator status, server status, and social application installation status.
[0050] Step a2: Launch the social application in the test environment. In response to the simulated account addition operation, enter the account information interface for adding the account to be tested.
[0051] Since account status detection is typically performed in an Android emulator, the connection status of the test environment can be checked. The test environment refers to the hardware and software environment required to run the automated detection script. For example, the test environment may include an emulator, an automation server (e.g., Appium server), and social applications installed in the emulator. The connection status includes the emulator status, server status, and social application installation status. The emulator status indicates whether the emulator has started normally, whether it has established a connection with the host via ADB (Android Debug Bridge), and whether it is in an operable state. This can be determined by querying the device list using ADB commands. The server status refers to whether the automation server (e.g., Appium server) has started and can normally receive and execute automated commands. The social application installation status refers to whether the social application (e.g., WeChat, Alipay, Weibo, etc., which allow adding friends) has been installed on the emulator. In this embodiment, this can be determined by querying the list of installed applications using ADB commands. Simulator status checks ensure the target device is online and recognizable by ADB, preventing subsequent operations from failing due to device disconnection. Server status checks ensure the automation server is running and capable of receiving commands, preventing scripts from being unable to interact with the device due to service failure. Social application installation status checks ensure the tested application is installed, preventing the testing process from being invalid due to missing applications. After completing the connection status checks in the test environment, the social application can be launched in the test environment, and an account addition simulation operation can be performed within the social application, leading to the account information interface for adding the account to be tested.
[0052] In some alternative implementations, step a2, "in response to the simulated account addition operation, enters the account information interface for adding the account to be tested", includes steps a21 and a22.
[0053] Step a21: In response to a simulated click operation of adding a contact control to the main interface of the social application, the add friend interface is displayed.
[0054] Step a22: In response to a simulated input operation on the input box in the Add Friend interface, enter the account to be tested and enter the account information interface for adding the account to be tested. Alternatively, in response to a simulated click operation on the QR code scanning control in the Add Friend interface, load the album of the test environment, select the QR code corresponding to the account to be tested in the album, and enter the account information interface for adding the account to be tested.
[0055] In the main interface of a social networking app, you can simulate clicking the "Add Contacts" control to enter the "Add Friends" screen. In the case of WeChat, you can simulate clicking the "Add Contacts" button in the upper right corner. Click the "Add Friend" button to enter the add friend interface. In social applications, there are multiple ways to add friends, such as searching and adding friends by account ID or by scanning a QR code. In this embodiment, simulated input operations can be performed on the input boxes in the add friend interface. For example, in the case of WeChat, the WeChat ID or mobile phone number of the account to be tested can be entered into the input box, and the account information interface for adding the account to be tested can be accessed. Alternatively, the QR code scanning control in the add friend interface can be simulated, and the album in the test environment can be opened, selecting the pre-saved QR code image corresponding to the account to be tested, and then entering the account information interface for adding the account to be tested.
[0056] Step S402: Determine the current click position in the account information interface. The current click position is determined by subtracting a preset step size from the ordinate of the previous click position. The preset step size is less than the height of the friend adding control in the account information interface.
[0057] Please see details Figure 1 Step S202 of the illustrated embodiment will not be described again here.
[0058] Step S403: Perform a click operation on the current click position, obtain the current optical character recognition result of the current interface, and compare it with the historical optical character recognition result corresponding to the historical click position to determine the degree of difference between the current optical character recognition result and the historical optical character recognition result.
[0059] Specifically, step S403, "obtaining the current optical character recognition result of the current interface", includes steps S4031 and S4032.
[0060] Step S4031: Based on multiple page segmentation modes, perform optical character recognition processing on the current interface in sequence.
[0061] Step S4032: If any page segmentation mode returns the corresponding page optical character recognition result, use the page optical character recognition result as the current optical character recognition result.
[0062] When optical character recognition (OCR) is required on the current interface after each click, the text layout may differ across interfaces (e.g., some interfaces display concentrated text blocks, while others have scattered button text). A single page segmentation mode cannot guarantee successful text recognition in all layouts. However, the OCR engine can provide multiple Page Segmentation Modes (PSMs). Different modes correspond to different text layout assumptions, such as treating the image as a uniform text block, treating it as sparse text, or automatically segmenting the page. In this embodiment, multiple page segmentation modes can be preset, such as PSM=6, PSM=11, PSM=3, etc. Then, according to a preset order, different page segmentation modes are used sequentially to perform OCR on the current interface.
[0063] In the process of sequentially performing optical character recognition processing based on multiple page segmentation modes, once a page segmentation mode returns an optical character recognition result, it means that the current interface has completed recognition and generated the page's optical character recognition result. At this point, the attempt to follow up with subsequent page segmentation modes can be stopped, and the optical character recognition result of this page can be used as the current optical character recognition result.
[0064] By sequentially performing optical character recognition processing on the current interface based on multiple page segmentation modes, the most suitable page segmentation mode can be used for different interface layouts, significantly improving the success rate of optical character recognition and avoiding interruption or misjudgment of the entire detection process due to the failure of a single page segmentation mode, thus improving accuracy.
[0065] In some optional implementations, step S403, “determining the degree of difference between the current optical character recognition result and the historical optical character recognition result,” includes steps b1 and b2.
[0066] Step b1: Calculate the editing distance between the current optical character recognition result and the historical optical character recognition result using a distance algorithm.
[0067] Step b2: Determine the degree of difference based on the edit distance.
[0068] After determining the current and historical optical character recognition (OCR) results, a distance algorithm can be used to calculate the difference between two strings. Distance algorithms are mathematical algorithms used to calculate the degree of difference between two strings, such as the Levenshtein distance algorithm and the Hamming distance algorithm. In this embodiment, the Levenshtein distance algorithm can be used to calculate the edit distance between the current and historical OCR results. The edit distance is a specific numerical value calculated by the distance algorithm, representing the degree of text difference, i.e., the minimum number of operations required to transform one string into another. The larger the edit distance value, the greater the difference between the two texts.
[0069] After determining the edit distance, the corresponding degree of difference can be determined based on the edit distance. For example, the edit distance can be directly used as the degree of difference; the edit distance can be normalized and the normalized edit distance can be used as the degree of difference; or the edit distance can be multiplied by a preset parameter to determine the corresponding degree of difference.
[0070] Step S404: If the difference is greater than a preset threshold, determine the page text based on the current optical character recognition result.
[0071] Please see details Figure 1 Step S204 of the illustrated embodiment will not be described again here.
[0072] Step S405: Determine the account status of the account to be tested based on the correspondence between the page text and preset keywords. Account status includes: can be added directly, requires verification to add, or account is abnormal.
[0073] Please see details Figure 1 Step S205 of the illustrated embodiment will not be described again here.
[0074] In some alternative implementations, the account status detection method further includes step c1.
[0075] Step c1: If the difference is less than or equal to a preset threshold, determine the next click position by subtracting a preset step size from the ordinate of the current click position, and perform a click operation on the next click position to obtain the optical character recognition result of the current interface, until the difference corresponding to the optical character recognition result of the current interface is greater than the preset threshold.
[0076] If the difference is less than or equal to a preset threshold, it indicates that the currently simulated click position did not click the friend add control, and no page jump is triggered. At this point, the x-coordinate of the current click position can be used as the x-coordinate of the next click position, and the y-coordinate of the current click position can be subtracted from the preset step size to obtain the y-coordinate of the next click position, thus determining the next click position. After determining the next click position, a simulated click operation can be performed on the next click position, and the current optical character recognition result of the current interface can be obtained. This result is then compared with the historical optical character recognition result corresponding to a historical click position (e.g., the previous click position), and the difference between the current optical character recognition result and the historical optical character recognition result is determined again. Steps S403 and S404 are then executed, using the next click position as the current click position, until the difference corresponding to the current optical character recognition result of the interface is greater than the preset threshold, i.e., until a page jump occurs.
[0077] In some alternative implementations, the account status detection method further includes step d1.
[0078] Step d1: If there is no previous click position corresponding to the current click position, take half the width of the account information interface as the horizontal coordinate of the current click position, and take the height of the account information interface minus the preset step size as the vertical coordinate of the current click position. Determine the current click position based on the horizontal and vertical coordinates.
[0079] If there is no corresponding previous click position at the current click location, meaning the current click location is the first click location on the account information interface, the current click location can be determined using the width and height of the account information interface, as well as a preset step size. In this embodiment, half the width of the account information interface can be used as the x-coordinate of the current click location, and the height of the account information interface minus the preset step size can be used as the y-coordinate of the current click location. The current click location is determined based on the x-coordinate and y-coordinate. For example, if the current account information interface size is 1080*1920 and the preset step size is 15, half the width of the interface can be used as the x-coordinate of the current click location, i.e., 540 (i.e., 1080 / 2), and the height of the interface minus the preset step size can be used as the y-coordinate of the current click location, i.e., 1905 (i.e., 1920-15). In this case, the position (540, 1905) on the account information interface can be used as the current click location.
[0080] In some alternative implementations, the account status detection method further includes step e1.
[0081] Step e1: Perform a return operation to return to the main interface of the social application and test the next account to be tested.
[0082] After completing the status check of the current account under test, a return operation can be simulated in the test environment. For example, clicking the "back" button in the simulator can be simulated to return to the main interface of the social application and then check the next account under test. During the batch testing of accounts under test, multiple accounts under test can be pre-configured in a test queue or data list, and an automated script can read and process them sequentially. By reading the next account from the pre-configured account queue, the complete process from entering the account information interface (i.e., step S401) to determining the account status (i.e., step S405) is repeated, realizing batch and continuous automated testing of multiple accounts under test.
[0083] The account status detection method provided in this embodiment simulates a user's account addition behavior, causing the social application to automatically jump to the account information interface of the account under test, providing an accurate and repeatable operating environment for subsequent clicks and recognition. By dynamically generating the current click position, it ensures that each click position can cover the entire vertical area where the control may appear. Simultaneously, because it does not rely on the attributes of controls in the social application or fixed coordinates, it avoids the element positioning failure problem caused by version upgrades and interface changes in the social application, exhibiting good version compatibility and resolution adaptation capabilities. By comparing the optical character recognition results after two clicks, the degree of change in the interface content can be quantified, enabling the determination of whether a substantial interface jump has occurred. This avoids misjudgments caused by environmental interference, significantly improving the accuracy and reliability of detection. By sequentially performing optical character recognition processing on the current interface based on multiple page segmentation modes, the most suitable page segmentation mode can be used for different interface layouts, significantly improving the success rate of optical character recognition and avoiding interruptions or misjudgments in the entire detection process due to the failure of a single page segmentation mode, thus improving accuracy.
[0084] This embodiment also provides an account status detection device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0085] This embodiment provides an account status detection device, such as... Figure 5 As shown, it includes: The information interface module 501 is used to respond to the account addition operation and display the account information interface for adding the account to be tested.
[0086] Click position module 502 is used to determine the current click position in the account information interface. The current click position is determined by subtracting a preset step size from the ordinate of the previous click position. The preset step size is less than the height of the friend adding control in the account information interface.
[0087] The click operation module 503 is used to perform a click operation on the current click position, obtain the current optical character recognition result of the current interface, and compare it with the historical optical character recognition result corresponding to the historical click position to determine the degree of difference between the current optical character recognition result and the historical optical character recognition result.
[0088] The difference module 504 is used to determine the page text based on the current optical character recognition result when the difference is greater than a preset threshold.
[0089] The status determination module 505 is used to determine the account status of the account to be tested based on the correspondence between the page text and preset keywords. The account status includes: can be added directly, requires verification to add, or the account is abnormal.
[0090] In some optional implementations, the account status detection device further includes: The click location determination module is used to determine the next click location by subtracting a preset step size from the ordinate of the current click location when the difference is less than or equal to a preset threshold, and then perform a click operation on the next click location to obtain the optical character recognition result of the current interface, until the difference corresponding to the optical character recognition result of the current interface is greater than the preset threshold.
[0091] In some optional implementations, the account status detection device further includes: The initial click position module is used to determine the current click position when there is no corresponding previous click position. It takes half the width of the account information interface as the horizontal coordinate of the current click position and the height of the account information interface minus a preset step as the vertical coordinate of the current click position. The current click position is determined based on the horizontal and vertical coordinates.
[0092] In some alternative implementations, the click operation module 503 includes: The page segmentation submodule is used to perform optical character recognition processing on the current interface sequentially based on multiple page segmentation modes.
[0093] The recognition result submodule is used to take the page optical character recognition result as the current optical character recognition result when any page segmentation mode returns the corresponding page optical character recognition result.
[0094] In some alternative implementations, the click operation module 503 includes: The Edit Distance submodule is used to calculate the edit distance between the current optical character recognition result and the historical optical character recognition result using a distance algorithm.
[0095] The difference submodule is used to determine the difference based on the edit distance.
[0096] In some alternative implementations, the information interface module 501 includes: The environment detection submodule is used to detect the connection status of the test environment. The connection status includes the emulator status, server status, and social application installation status.
[0097] The information interface submodule is used to launch the social application in the test environment and, in response to the simulated account addition operation, enter the account information interface for adding the account to be tested.
[0098] In some alternative implementations, the information interface submodule includes: Add a UI element to respond to a simulated click operation of adding a contacts control to the main interface of a social application, and display the add friend interface.
[0099] The input unit is used to respond to a simulated input operation on the input box of the "Add Friend" interface, inputting the account to be tested and entering the account information interface for adding the account to be tested. Alternatively, in response to a simulated click operation on the QR code scanning control of the "Add Friend" interface, it loads the album of the test environment, selects the QR code corresponding to the account to be tested from the album, and enters the account information interface for adding the account to be tested.
[0100] In some optional implementations, the account status detection device further includes: The return operation module is used to perform a return operation to return to the main interface of the social application and to test the next account to be tested.
[0101] The account status detection device provided in this application embodiment can execute the account status detection method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects of the method execution. Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0102] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0103] The following is a detailed reference. Figure 6This diagram illustrates a suitable structural schematic for implementing the electronic device described in the embodiments of this application. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from memory 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the electronic device. The processor 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0104] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0105] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a memory 608, or installed from a ROM 602. When the computer program is executed by the processor 601, it performs the functions defined in the account status detection method of embodiments of this application.
[0106] Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0107] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the account status detection method shown in the above embodiments is implemented.
[0108] A portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0109] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A method for detecting account status, characterized in that, The method includes: In response to the account addition operation, the account information interface for adding the account to be tested is displayed; Determine the current click position in the account information interface; the current click position is determined by subtracting a preset step size from the ordinate of the previous click position; the preset step size is less than the height of the friend adding control in the account information interface; A click operation is performed on the current clicked position to obtain the current optical character recognition result of the current interface, and it is compared with the historical optical character recognition result corresponding to the historical clicked position to determine the degree of difference between the current optical character recognition result and the historical optical character recognition result; If the difference is greater than a preset threshold, the page text is determined based on the current optical character recognition result; Based on the correspondence between the page text and preset keywords, the account status of the account to be tested is determined; the account status includes whether it can be added directly, requires verification to add, or is abnormal.
2. The method according to claim 1, characterized in that, The method further includes: If the difference is less than or equal to the preset threshold, the next click position is determined by subtracting the preset step size from the ordinate of the current click position, and a click operation is performed on the next click position to obtain the optical character recognition result of the current interface, until the difference corresponding to the optical character recognition result of the current interface is greater than the preset threshold.
3. The method according to claim 1, characterized in that, The method further includes: If there is no corresponding previous click position at the current click position, half the width of the account information interface is used as the horizontal coordinate of the current click position, and the height of the account information interface minus the preset step size is used as the vertical coordinate of the current click position. The current click position is determined based on the horizontal and vertical coordinates.
4. The method according to claim 1, characterized in that, The step of obtaining the current optical character recognition result of the current interface includes: Based on multiple page segmentation modes, optical character recognition processing is performed on the current interface in sequence; If any page segmentation mode returns the corresponding page optical character recognition result, the page optical character recognition result shall be used as the current optical character recognition result.
5. The method according to claim 1, characterized in that, Determining the difference between the current optical character recognition result and the historical optical character recognition result includes: The current optical character recognition result and the historical optical character recognition result are compared using a distance algorithm to determine the edit distance between the current optical character recognition result and the historical optical character recognition result; The degree of difference is determined based on the edit distance.
6. The method according to claim 1, characterized in that, The response to the account addition operation, displaying an account information interface for adding the account to be tested, includes: Detect the connection status of the test environment; the connection status includes the simulator status, server status, and social application installation status. Launch the social application in the test environment. In response to the simulated account addition operation, enter the account information interface for adding the account to be tested.
7. The method according to claim 6, characterized in that, The response to the simulated account addition operation, entering the account information interface for adding the account to be tested, includes: In response to a simulated click operation to add a contacts control to the main interface of the social application, the add friend interface is displayed; In response to a simulated input operation on the input box in the Add Friend interface, the user enters the account to be tested and enters the account information interface for adding the account to be tested; or, in response to a simulated click operation on the QR code scanning control in the Add Friend interface, the user loads the album of the test environment, selects the QR code corresponding to the account to be tested in the album, and enters the account information interface for adding the account to be tested.
8. The method according to claim 1, characterized in that, After determining the account status of the account to be tested, the method further includes: The system will then return to the main interface of the social application and begin testing the next account to be tested.
9. An account status detection device, characterized in that, The device includes: The information interface module is used to respond to the account addition operation and display the account information interface for adding the account to be tested; The click location module is used to determine the current click location in the account information interface; the current click location is determined by subtracting a preset step size from the ordinate of the previous click location; the preset step size is less than the height of the friend adding control in the account information interface; The click operation module is used to perform a click operation on the current click position, obtain the current optical character recognition result of the current interface, and compare it with the historical optical character recognition result corresponding to the historical click position to determine the degree of difference between the current optical character recognition result and the historical optical character recognition result. The difference module is used to determine the page text based on the current optical character recognition result when the difference is greater than a preset threshold. The status determination module is used to determine the account status of the account to be tested based on the correspondence between the page text and preset keywords; the account status includes whether it can be added directly, whether it needs to be verified before addition, or whether the account is abnormal.
10. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the account status detection method according to any one of claims 1 to 8.