A script-based task processing method and device

By writing task scripts for office scenarios, identifying and simulating office page operations, the problems of strong repetition and cumbersome processes are solved, automated processing is realized, labor costs are reduced, and office efficiency is improved.

CN113010159BActive Publication Date: 2024-12-27CHINA CONSTRUCTION BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110310785.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-23
Publication Date
2024-12-27
Estimated Expiration
2041-03-23

AI Technical Summary

Technical Problem

In office scenarios, in the prior art, the work content that requires regular batch processing is highly repetitive and cumbersome, resulting in manual processing wastes human resources, affects office efficiency, and reduces employees' work enthusiasm.

Method used

By obtaining task scripts written for work tasks, identifying the target elements of the target page and simulating clicks, inputs and other operations, automated processing is achieved, labor costs are reduced, and office efficiency is improved.

Benefits of technology

Without manual operations, automated task processing scripts can identify and simulate operations, reduce labor costs, improve office efficiency, and free up human resources for higher-difficulty jobs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113010159B_ABST
    Figure CN113010159B_ABST
Patent Text Reader

Abstract

The present invention discloses a script-based task processing method and device, and relates to the field of office automation technology. A specific implementation of the method includes: obtaining a task script written for a work task to be processed; wherein the task script is used to identify a target element of a target page, and simulates the operation indicated by a workflow at the position where the target element is identified, and the workflow is used to implement the work task; determining that the work task does not meet the set timed execution conditions, executing the task script on the target page, and completing the work task. This implementation method obtains a task script written for a work task, so that when executing the task script, the target element of the target page can be identified, and then operations such as clicking and inputting can be simulated, without manual operation, thereby reducing labor costs and improving office efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of office automation, and in particular to a script-based task processing method and device. Background Art

[0002] In office scenarios, there are many tasks that need to be processed regularly in batches, and these tasks are highly repetitive, with complicated processes and low execution difficulty. For example, a work order needs to be created every time a product that is being developed or has been developed is changed, and push content needs to be checked regularly. In order to handle the above tasks, relevant personnel are usually arranged to handle them manually in the prior art.

[0003] In the process of implementing the present invention, there are at least the following problems in the prior art:

[0004] It wastes human resources, affects office efficiency, and reduces employee work enthusiasm. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a script-based task processing method and device. The method obtains a task script written for a work task, so that when the task script is executed, the target elements of the target page can be identified, and then click, input and other operations are simulated without manual operation, thereby reducing labor costs and improving office efficiency.

[0006] To achieve the above objective, according to one aspect of an embodiment of the present invention, a script-based task processing method is provided.

[0007] A script-based task processing method according to an embodiment of the present invention comprises: obtaining a task script written for a work task to be processed; wherein the task script is used to identify a target element of a target page, and simulate the operation indicated by a workflow at the location where the target element is identified, and the workflow is used to implement the work task; determining that the work task does not meet a set timed execution condition, and executing the task script on the target page to complete the work task.

[0008] Optionally, the target page includes a login page, and the corresponding target elements include an account name input box, a password input box and a login button; the target element of the target page is identified, and the operation indicated by the workflow is simulated at the position where the target element is identified, including: identifying the account name input box and password input box of the login page, using the input method to fill in the set account name in the account name input box, and filling in the set password in the password input box; identifying the login button of the login page, and using the click method to click the login button.

[0009] Optionally, the target page includes a task search page, and the corresponding target elements include a task search input box and a search button; the target element of the target page is identified, and the operation indicated by the workflow is simulated at the position where the target element is identified, including: identifying the task search input box of the task search page, and using the input method to fill in the set task number in the task search input box; identifying the search button of the task search page, and using the click method to click the search button.

[0010] Optionally, the target page includes a task configuration page, and the corresponding target elements include a task name list, a task stage list and a create button; identifying the target element of the target page and simulating the operation indicated by the workflow at the position where the target element is identified, including: identifying the task name list of the task configuration page, and selecting the corresponding task name in the task name list using the click method; wherein the task configuration page is the page to which the search button jumps after clicking; identifying the task stage list of the task configuration page, and selecting the corresponding task stage in the task stage list using the click method; identifying the create button of the task configuration page, and clicking the create button using the click method.

[0011] Optionally, the target page includes a task creation page, and the corresponding target elements include a personnel query input box and a submit button; the target element of the target page is identified, and the operation indicated by the workflow is simulated at the position where the target element is identified, including: identifying the personnel query input box of the task creation page, and searching for a set personnel identifier in the personnel query input box; wherein the task creation page is the page jumped to after clicking the search button or the create button; identifying the submit button of the task creation page, and clicking the submit button using the click method.

[0012] Optionally, the target element also includes a creation type drop-down box and a task description input box; the target element of the target page is identified, and the operations indicated by the workflow are simulated at the position where the target element is identified, including: identifying the creation type drop-down box of the task creation page, and using the click method to select the corresponding creation type in the creation type drop-down box; identifying the task description input box of the task creation page, and using the input method to enter task description information in the task description input box.

[0013] Optionally, identifying the target element of the target page includes: identifying the target element of the target page according to a set element identifier or style feature of the target element.

[0014] Optionally, the timed execution conditions include: the task is executed periodically, and the task parameters are known quantities or change regularly.

[0015] Optionally, the task script is also used to start a browser and open the target page.

[0016] Optionally, the method further includes: determining that the work task satisfies the scheduled execution condition, obtaining a scheduled script, and using the scheduled script to trigger the periodic execution of the task script on the target page.

[0017] Optionally, the task script is implemented based on a puppeteer testing framework or a selenium testing tool.

[0018] Optionally, after the step of executing the task script on the target page, the method further includes: visually displaying the execution result generated by executing the task script.

[0019] Optionally, the method further includes: configuring a unique element identifier for the target element, and writing the target element and the corresponding element identifier into a configuration file.

[0020] To achieve the above objective, according to another aspect of an embodiment of the present invention, a script-based task processing device is provided.

[0021] A script-based task processing device according to an embodiment of the present invention includes: an acquisition module, used to acquire a task script written for a work task to be processed; wherein the task script is used to identify a target element of a target page, and simulate the operation indicated by a workflow at the location where the target element is identified, and the workflow is used to implement the work task; an execution module, used to determine that the work task does not meet the set timed execution conditions, and execute the task script on the target page to complete the work task.

[0022] Optionally, the target page includes a login page, and the corresponding target elements include an account name input box, a password input box and a login button; the task script is also used to identify the account name input box and password input box of the login page, and use the input method to fill in the set account name in the account name input box and the set password in the password input box; and identify the login button of the login page, and use the click method to click the login button.

[0023] Optionally, the target page includes a task search page, and the corresponding target elements include a task search input box and a search button; the task script is also used to identify the task search input box of the task search page, and use the input method to fill in the set task number in the task search input box; and identify the search button of the task search page, and use the click method to click the search button.

[0024] Optionally, the target page includes a task configuration page, and the corresponding target elements include a task name list, a task stage list and a create button; the task script is also used to identify the task name list of the task configuration page, and select the corresponding task name in the task name list using the click method; wherein the task configuration page is the page to which the search button jumps after clicking; identify the task stage list of the task configuration page, and select the corresponding task stage in the task stage list using the click method; and identify the create button of the task configuration page, and click the create button using the click method.

[0025] Optionally, the target page includes a task creation page, and the corresponding target elements include a personnel query input box and a submit button; the task script is also used to identify the personnel query input box of the task creation page, and search for a set personnel identifier in the personnel query input box; wherein the task creation page is the page to which the user jumps after clicking the search button or the create button; and identify the submit button of the task creation page, and click the submit button using the click method.

[0026] Optionally, the target element also includes a creation type drop-down box and a task description input box; the task script is also used to identify the creation type drop-down box of the task creation page, and use the click method to select the corresponding creation type in the creation type drop-down box; and identify the task description input box of the task creation page, and use the input method to enter the task description information in the task description input box.

[0027] Optionally, the task script is further used to identify the target element of the target page according to the element identifier or style feature of the set target element.

[0028] Optionally, the timed execution conditions include: the task is executed periodically, and the task parameters are known quantities or change regularly.

[0029] Optionally, the task script is also used to start a browser and open the target page.

[0030] Optionally, the device further comprises: a timing processing module, configured to determine whether the work task satisfies the timing execution condition, obtain a timing script, and use the timing script to trigger the periodic execution of the task script on the target page.

[0031] Optionally, the task script is implemented based on a puppeteer testing framework or a selenium testing tool.

[0032] Optionally, the device further includes: a display module, configured to visually display the execution result generated by executing the task script.

[0033] Optionally, the device further includes: a configuration module, configured to configure a unique element identifier for the target element, and write the target element and the corresponding element identifier into a configuration file.

[0034] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0035] An electronic device according to an embodiment of the present invention comprises: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a script-based task processing method according to an embodiment of the present invention.

[0036] To achieve the above objective, according to another aspect of the embodiments of the present invention, a computer readable medium is provided.

[0037] A computer-readable medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, a script-based task processing method according to an embodiment of the present invention is implemented.

[0038] An embodiment of the above invention has the following advantages or beneficial effects: by obtaining a task script written for a work task, the target element of the target page can be identified when the task script is executed, and then click, input and other operations can be simulated, without manual operation, reducing labor costs and improving office efficiency. The automatic login function is realized by identifying the account name input box, password input box and login button on the login page, and simulating the input and click actions at the identified position.

[0039] The automatic search function is implemented by identifying the task search input box and search button on the task search page and simulating the input and click actions at the identified locations. The automatic configuration function is implemented by identifying the task name list, task stage list and create button on the task configuration page and simulating the click actions at the identified locations. The automatic task creation function is implemented by identifying the personnel query input box and submit button on the task creation page and simulating the query and click actions at the identified locations.

[0040] By identifying the creation type drop-down box and task description input box on the task creation page, and simulating the input and click actions at the identified location, tasks with richer attributes can be created. Identify the target element based on element identification or style features to facilitate locating the target element on the target page. By setting scheduled execution conditions, work tasks that meet the scheduled execution conditions can be executed periodically, further improving office efficiency. When the work task starts to execute, start the browser through the task script and open the target page so that the subsequent workflow can continue.

[0041] Writing task scripts based on the puppeteer test framework or selenium test tool can replace a large amount of manual work, greatly improve work efficiency, release human resources, reduce labor costs, and allocate more labor to more difficult jobs. By visualizing the execution results, developers can understand the execution status of the work tasks. By setting a unique element identifier for the target element, it is easy to identify the location of the target element on the target page.

[0042] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0044] Figure 1 is a schematic diagram of the main steps of a script-based task processing method according to an embodiment of the present invention;

[0045] Figure 2 is a main flow chart of a script-based task processing method according to another embodiment of the present invention;

[0046] Figure 3 is a main flow chart of a script-based task processing method according to yet another embodiment of the present invention;

[0047] Figure 4 is a schematic diagram of main modules of a script-based task processing device according to an embodiment of the present invention;

[0048] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0049] Figure 6 It is a schematic diagram of the structure of a computer device suitable for implementing the electronic device of the embodiment of the present invention. DETAILED DESCRIPTION

[0050] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0051] The following is an explanation of the terms involved in the embodiments of the present invention.

[0052] Puppeteer: is a Node.js package released by the Chrome development team to simulate the operation of the Chrome browser. It provides a series of APIs to control the behavior of the Chrome or Chromium browser through the DevTools Protocol. By default, puppeteer starts Chrome in headless mode, which does not display pages. It can also be configured to start Chrome in non-headless mode.

[0053] API: Application Programming Interface. API is a set of predefined functions that aims to provide applications and developers with the ability to access a set of routines based on certain software or hardware without having to access the source code or understand the details of the internal working mechanism.

[0054] DevTools: is a set of web development and debugging tools built into Chrome that can be used to iterate, debug, and analyze websites.

[0055] As described in the background technology, in office scenarios, work that requires regular batch processing, is highly repetitive, and has cumbersome processes is usually handled manually. However, manual processing will lead to a waste of human resources, increase labor costs, and affect office efficiency. Therefore, an embodiment of the present invention provides a script-based task processing method that can greatly reduce labor costs and significantly improve office efficiency, which is described in detail below.

[0056] Embodiment 1

[0057] Figure 1 FIG. 1 is a schematic diagram of the main steps of the script-based task processing method according to an embodiment of the present invention. Figure 1 As shown, the script-based task processing method of the embodiment of the present invention mainly includes the following steps:

[0058] Step S101: Obtain a task script written for the work task to be processed. The work task here has any one or more of the following characteristics: high repetitiveness, complicated process, and regular execution. In the embodiment, high repetitiveness may refer to the execution frequency of the work task being greater than a set frequency threshold, and complicated process may refer to the operation steps of the work task being greater than a set number.

[0059] For the work tasks to be processed, it is necessary to sort out their workflows, and then write task scripts based on the Puppetee R testing framework or the Selenium testing tool. The sorting out of the workflow is used to provide an overall logical framework for writing task scripts. The task script includes program codes for identifying the target elements of the target page, and program codes for simulating the operations indicated by the workflow at the location where the target elements are identified. The operations here include clicks, inputs, and other operations.

[0060] When identifying the target element of the target page, it can be identified according to a pre-set element identifier or style feature. For the method of using an element identifier to identify the target element, it is necessary to configure a unique element identifier for the target element when writing the program code to implement the target page, and write the target element and the corresponding element identifier into the configuration file. When identifying the target element, by identifying the element identifier of the target page and querying the configuration file according to the identified element identifier, the corresponding target element can be determined.

[0061] In an embodiment, the style feature may refer to the CSS (Cascading Style Sheets) style of the page element, including input box style, button style, list style, etc. For the method of using style features to identify the target element, that is, to identify whether the target element of the target page has a specified style feature, if the specified style feature is met, it can be identified as the corresponding target element. For example, if a target element meets the input box style, it can be identified as an input box.

[0062] In a preferred embodiment, the task script also includes program code for starting a browser and opening a target page, so that a target element of the target page can be subsequently identified and the operation indicated by the workflow can be simulated at the location where the target element is identified.

[0063] After the task script is written, it is saved. When the work task needs to be executed, such as when a task execution instruction is received, the corresponding task script can be obtained directly according to the task identifier carried in the task execution instruction.

[0064] Step S102: Determine whether the work task meets the set timed execution conditions. If the work task does not meet the timed execution conditions, execute step S103; otherwise, execute step S104. The timed execution conditions include the periodic execution of the task, and the task parameters are known quantities or change regularly. Among them, the task parameters are known quantities, which means that each time the task script of the work task is executed, there is no need to modify the various task parameters contained in the task script. The regular changes in task parameters indicate that each time the task script of the work task is executed, the modification of the task parameters can be directly implemented through the program code.

[0065] This step is to determine whether the work task needs to be executed periodically, and whether the task parameters are known quantities or change regularly. Among them, periodic execution refers to regular repeated execution, such as execution at a fixed time every day, execution once a week, execution once a month, etc. Regular changes mean that each time the task script is executed, the changes in the required task parameters have a fixed pattern, such as increasing or decreasing the fixed step size each time the task script is executed.

[0066] If the work task needs to be executed periodically and the task parameters are known quantities, then the work task meets the timed execution conditions; if the work task needs to be executed periodically and the task parameters are unknown quantities but change regularly, then the work task also meets the timed execution conditions; if the work task does not need to be executed periodically, or the task parameters are unknown quantities and change irregularly, then the work task does not meet the timed execution conditions.

[0067] Step S103: Execute the task script on the target page to complete the work task. For the work task that does not meet the timed execution condition, directly run the task script on the target page to complete the work task.

[0068] Step S104: Obtain a timing script to use the timing script to trigger the periodic execution of the task script on the target page. For tasks that need to be executed periodically and do not need to modify the task parameters each time they are executed, and for tasks that need to be executed periodically and can modify the task parameters through program code each time they are executed, a timing script can be written.

[0069] Among them, the scheduled script includes program codes for implementing regular execution. For work tasks that meet the scheduled execution conditions, it is necessary to obtain the scheduled script, and use the scheduled script to trigger the automatic execution of the task script, reducing the risk of missing execution due to manual maintenance.

[0070] Embodiment 2

[0071] Figure 2 FIG. 1 is a schematic diagram of the main flow chart of a script-based task processing method according to another embodiment of the present invention. Figure 2 As shown, the script-based task processing method of the embodiment of the present invention takes the login task as the work task to be processed, and mainly includes the following steps:

[0072] Step S201: Get the task script written for the login task. In this embodiment, the login task needs to be executed at 8:00 a.m. every day, and the account name and password required for login remain unchanged. For this login task, the workflow is as follows: open the browser → enter the page URL → enter the corresponding login page → enter the account name and password → click the login button → complete the login.

[0073] In combination with the above workflow, a task script corresponding to the login task is written based on the puppeteer test framework. The task script includes program code for starting the browser, identifying the address bar of the browser homepage, entering the page URL in the address bar, opening the login page, program code for identifying the account name input box and password input box in the login page, program code for filling the account name and password in the account name input box and password input box respectively, program code for identifying the login button in the login page, and program code for clicking the login button.

[0074] The operation of filling in the account name and password in the task script is implemented using the input method, and the operation of clicking the login button is implemented using the click method. After the task script is written, save it. When receiving the task execution instruction, directly obtain the above task script according to the task identifier carried in the task execution instruction.

[0075] Step S202: Determine whether the login task meets the set timed execution conditions. The timed execution conditions include that the task is executed periodically and the task parameters are known quantities or change regularly. Since the login task needs to be executed at 8:00 a.m. every day, and the account name and password required for login are fixed, that is, the login task needs to be executed periodically and the task parameters are known quantities, it meets the timed execution conditions and executes step S203.

[0076] Step S203: Obtain a timing script to use the timing script to trigger the periodic execution of the task script on the target page. The timing script includes program code to implement the execution of the login task at 8:00 a.m. every day. Use the timing script to trigger the task script to automatically execute at 8:00 a.m. every day. Among them, the business logic implemented by the task script includes:

[0077] (1) Start the browser and identify the address bar of the browser homepage;

[0078] (2) Enter the page URL in the address bar to open the login page;

[0079] (3) Identify the account name input box and password input box on the login page, use the input method to fill the set account name in the account name input box, and use the input method to fill the set password in the password input box;

[0080] (4) Identify the login button on the login page and use the click method to click the login button to complete the login task.

[0081] Embodiment 3

[0082] Figure 3 FIG. 1 is a schematic diagram of the main flow of a script-based task processing method according to another embodiment of the present invention. Figure 3As shown, the script-based task processing method of the embodiment of the present invention takes the work order creation task as the work task to be processed, and mainly includes the following steps:

[0083] Step S301: Get the task script written for the work order creation task. The task parameters required for the work order creation task in this embodiment include the task number and the personnel ID for which the work order is to be created. Among them, the task number is related to the actual demand, is not a known quantity, and has no regularity to follow, so it needs to be manually configured before each execution of the task script. At the same time, the frequency of creating work orders is related to the task online cycle, which is generally one month.

[0084] For the work order creation task, the workflow is as follows: create a new tab → jump to the login page for creating a work order → enter the account name and password → click the login button → enter the task search page → enter the task number → click the search button → enter the task configuration page → click the task name → click the task stage → click the Create button → enter the task creation page → select the creation type → enter the task description information → find the personnel ID → click the Submit button → the work order is created.

[0085] Combined with the above workflow, write the task script corresponding to the work order creation task based on the puppeteer test framework. Puppeteer is a Node.js package that communicates with the Chrome browser by calling the open interface of Chrome DevTools. It can be used to simulate the operation of the Chrome browser. After introducing this package, the program code can be used to simulate the user's operation on the page, such as jumping to the page address that needs to be operated, and inputting, clicking, and other operations on the page.

[0086] In this embodiment, the task script includes program codes for creating a new tab page, jumping to a login page, program codes for implementing a login function, program codes for implementing a task search function, program codes for implementing a task configuration function, and program codes for implementing a task creation function. After the task script is written, it can be saved. When a task execution instruction is received, the task script can be directly obtained according to the task identifier carried in the task execution instruction.

[0087] Step S302: Determine that the work order creation task does not meet the scheduled execution condition. The scheduled execution condition includes the periodic execution of the task and the task parameters are known quantities or change regularly. Since the task number required to create the work order is not a known quantity and there is no regularity to follow, it does not meet the scheduled execution condition, and step S303 is executed.

[0088] Step S303: Execute the task script on the target page to complete the work order creation task. As can be seen from the workflow, creating a work order requires operations on the login page, task search page, task configuration page, and task creation page, so the target page in this embodiment includes the above multiple pages. The business logic implemented by the task script includes:

[0089] (1) Create a new tab and jump to the login page for creating a work order;

[0090] (2) Identify the account name input box and password input box on the login page, use the input method to fill the set account name in the account name input box, and use the input method to fill the set password in the password input box;

[0091] (3) Identify the login button on the login page, use the click method to click the login button, and enter the task search page;

[0092] (4) Identify the task search input box on the task search page, and use the input method to enter the set task number on the task search page;

[0093] (5) Identify the search button on the task search page, use the click method to click the search button, and enter the task configuration page;

[0094] (6) Identify the task name list on the task configuration page, and use the click method to select the corresponding task name in the task name list; identify the task stage list on the task configuration page, and use the click method to select the corresponding task stage in the task stage list;

[0095] (7) Identify the create button on the task configuration page, use the click method to click the create button, and enter the task creation page;

[0096] (8) Identify the creation type drop-down box on the task creation page, use the click method to select the corresponding creation type in the creation type drop-down box; identify the task description input box on the task creation page, and use the input method to enter the task description information in the task description input box;

[0097] (9) Identify the personnel query input box on the task creation page, and search for the personnel ID of the person for whom the work order is to be created in the personnel query input box;

[0098] (10) Identify the submit button on the task creation page and use the click method to click the submit button to complete the work order creation task.

[0099] It is understandable that the business logic implemented by the task script in Example 3 is only an example. In this business logic, steps (2)-(3) are used to implement the login function, steps (4)-(5) are used to implement the task search function, steps (6)-(7) are used to implement the task configuration function, and steps (8)-(10) are used to implement the task creation function. In actual use, the business logic in the task script can be increased or decreased according to the workflow corresponding to the work task. For example, when only the search task needs to be implemented, the business logic includes steps (4)-(5).

[0100] In another embodiment, when creating a work order, task configuration may not be performed, and task creation may be performed directly, that is, after clicking the search button in step (5), the page directly jumps to the task creation page. In this case, the business logic implemented by the task script includes steps (1)-(5) and steps (8)-(10), or includes steps (1)-(5) and steps (9)-(10).

[0101] It can be seen from the script-based task processing method of the embodiment of the present invention that by using task scripts written based on puppeteer to process work order creation tasks, office efficiency is improved and labor costs are reduced.

[0102] Figure 4 Schematic diagram of the main modules of the script-based task processing device according to an embodiment of the present invention. Figure 4 As shown, the script-based task processing device 400 of the embodiment of the present invention mainly includes:

[0103] Acquisition module 401 is used to obtain the task script written for the pending work task. For the pending work task, it is necessary to comb through its workflow, and then write the task script based on puppeteer test framework or selenium test tool. Wherein, the combing of workflow is used to provide an overall logical framework for the writing of the task script. The task script includes a program code for identifying the target element of the target page, and a program code for simulating the operation indicated by the workflow at the position where the target element is identified.

[0104] When identifying the target element of the target page, it can be identified according to a pre-set element identifier or style feature. For the method of using an element identifier to identify the target element, it is necessary to configure a unique element identifier for the target element when writing the program code to implement the target page, and write the target element and the corresponding element identifier into the configuration file. When identifying the target element, by identifying the element identifier of the target page and querying the configuration file according to the identified element identifier, the corresponding target element can be determined.

[0105] In the embodiment, the style feature may refer to the CSS style of the page element, including the input box style, button style, list style, etc. For the method of using the style feature to identify the target element, that is, to identify whether the target element of the target page has the specified style feature, if the specified style feature is met, it can be identified as the corresponding target element. For example, if a target element meets the input box style, it can be identified as an input box.

[0106] After the task script is written, it is saved. When the work task needs to be executed, such as when a task execution instruction is received, the corresponding task script can be obtained directly according to the task identifier carried in the task execution instruction.

[0107] The execution module 402 is used to determine that the work task does not meet the set timed execution conditions, execute the task script on the target page, and complete the work task. The timed execution conditions include the periodic execution of the task and the task parameters are known quantities or regular changes. It is judged whether the work task meets the above-mentioned timed execution conditions. If the work task does not meet the timed execution conditions, the task script is executed on the target page to complete the work task.

[0108] In addition, the script-based task processing device 400 of the embodiment of the present invention may also include: a timing processing module, a display module and a configuration module ( Figure 4 Wherein, the timing processing module is used to determine that the work task meets the timing execution condition, obtain the timing script, and use the timing script to trigger the periodic execution of the task script on the target page.

[0109] The display module is used to visually display the execution result generated by executing the task script. The configuration module is used to configure a unique element identifier for the target element and write the target element and the corresponding element identifier into a configuration file.

[0110] From the above description, it can be seen that by obtaining the task script written for the work task, the target element of the target page can be identified when the task script is executed, and then click, input and other operations can be simulated without manual operation, thereby reducing labor costs and improving office efficiency.

[0111] Figure 5 An exemplary system architecture 500 is shown to which the script-based task processing method or the script-based task processing apparatus according to the embodiment of the present invention can be applied.

[0112] like Figure 5As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0113] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Terminal devices 501, 502, 503 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc.

[0114] The server 505 may be a server that provides various services, such as a background management server that processes task execution instructions sent by the administrator using the terminal devices 501, 502, and 503. The background management server may obtain task scripts, execute task scripts, and feed back processing results (such as execution results) to the terminal devices.

[0115] It should be noted that the script-based task processing method provided in the embodiment of the present application is generally executed by the server 505 , and accordingly, the script-based task processing device is generally set in the server 505 .

[0116] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0117] According to an embodiment of the present invention, the present invention also provides an electronic device and a computer-readable medium.

[0118] The electronic device of the present invention comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a script-based task processing method of an embodiment of the present invention.

[0119] The computer-readable medium of the present invention stores a computer program thereon, and when the program is executed by a processor, a script-based task processing method according to an embodiment of the present invention is implemented.

[0120] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 suitable for implementing an electronic device of an embodiment of the present invention. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0121] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0122] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0123] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the main step diagram. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0124] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0125] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0126] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an acquisition module and an execution module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the acquisition module may also be described as "a module for acquiring a task script written for a work task to be processed".

[0127] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining a task script written for a work task to be processed; wherein the task script is used to identify a target element of a target page, and simulate the operation indicated by the workflow at the location where the target element is identified, and the workflow is used to implement the work task; determining that the work task does not meet the set timed execution condition, executing the task script on the target page, and completing the work task.

[0128] According to the technical solution of the embodiment of the present invention, by obtaining the task script written for the work task, the target element of the target page can be identified when the task script is executed, and then the operations such as click and input can be simulated without manual operation, thereby reducing labor costs and improving office efficiency.

[0129] The above product can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.

[0130] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A script-based task processing method, characterized in that: include: Obtain a task script written for the work task to be processed; wherein the task script is used to identify the target element of the target page, and simulate the operation indicated by the workflow at the position where the target element is identified, and the workflow is used to implement the work task; wherein the work task is a work order creation task; Use the task script written by puppeteer to process the work order creation task. When creating the work order task, determine that the work task does not meet the set timed execution conditions, increase or decrease the business logic in the task script according to the workflow, do not configure the task, and directly create the task. After clicking the search button, jump directly to the task creation page, execute the task script after the business logic is increased or decreased on the target page, and complete the work task.

2. The method according to claim 1, characterized in that The target page includes a login page, and the corresponding target elements include an account name input box, a password input box, and a login button; The step of identifying a target element of a target page and simulating the operation indicated by the workflow at the position where the target element is identified includes: Identify the account name input box and password input box on the login page, and use the input method to fill the set account name in the account name input box and fill the set password in the password input box; Identify the login button on the login page, and click the login button using the click method.

3. The method according to claim 1, characterized in that The target page includes a task search page, and the corresponding target elements include a task search input box and a search button; The step of identifying a target element of a target page and simulating the operation indicated by the workflow at the position where the target element is identified includes: Identify the task search input box on the task search page, and use the input method to fill the task number set in the task search input box; Identify a search button on the task search page, and click the search button using a click method.

4. The method according to claim 3, characterized in that The target page includes a task configuration page, and the corresponding target elements include a task name list, a task stage list and a create button; The step of identifying a target element of a target page and simulating the operation indicated by the workflow at the position where the target element is identified includes: Identify the task name list of the task configuration page, and select the corresponding task name in the task name list using the click method; wherein the task configuration page is the page to which you jump after clicking the search button; Identify the task stage list on the task configuration page, and select the corresponding task stage in the task stage list using the click method; Identify a create button on the task configuration page, and click the create button using the click method.

5. The method according to claim 4, characterized in that The target page includes a task creation page, and the corresponding target elements include a personnel query input box and a submit button; The step of identifying a target element of a target page and simulating the operation indicated by the workflow at the position where the target element is identified includes: Identify the personnel query input box of the task creation page, and search for the set personnel identifier in the personnel query input box; wherein the task creation page is the page jumped to after clicking the search button or the create button; Identify a submit button on the task creation page, and click the submit button using the click method.

6. The method according to claim 5, characterized in that The target element also includes a creation type drop-down box and a task description input box; The step of identifying a target element of a target page and simulating the operation indicated by the workflow at the position where the target element is identified includes: Identify the creation type drop-down box on the task creation page, and select the corresponding creation type in the creation type drop-down box using the click method; Identify a task description input box on the task creation page, and use an input method to input task description information into the task description input box.

7. The method according to claim 1, characterized in that The identifying target element of the target page includes: According to the element identifier or style feature of the set target element, the target element of the target page is identified.

8. The method according to claim 1, characterized in that The timed execution conditions include: the task is executed periodically, and the task parameters are known quantities or change regularly.

9. The method according to claim 1, characterized in that: The task script is also used to start the browser and open the target page.

10. The method according to claim 1, characterized in that The method further comprises: Determine whether the work task meets the scheduled execution condition, obtain a scheduled script, and use the scheduled script to trigger the periodic execution of the task script on the target page.

11. The method according to any one of claims 1 to 10, characterized in that: The task script is implemented based on the puppeteer test framework or the selenium test tool.

12. The method according to claim 11, characterized in that After the step of executing the task script on the target page, the method further includes: The execution results generated by executing the task script are visually displayed.

13. The method according to claim 7, characterized in that The method further comprises: A unique element identifier is configured for the target element, and the target element and the corresponding element identifier are written into a configuration file.

14. A script-based task processing device, characterized in that: include: An acquisition module, used for acquiring a task script written for a work task to be processed; wherein the task script is used for identifying a target element of a target page, simulating the operation indicated by a workflow at the position where the target element is identified, and the workflow is used for implementing the work task; wherein the work task is a work order creation task; An execution module is used to process the work order creation task using a task script written in puppeteer. When creating a work order task, it is determined that the work task does not meet the set timed execution conditions, and the business logic in the task script is increased or decreased according to the workflow. Task configuration is not performed, and task creation is performed directly. After clicking the search button, it jumps directly to the task creation page, and the task script after the business logic is increased or decreased is executed on the target page to complete the work task.

15. The device according to claim 14, characterized in that The target page includes a login page, and the corresponding target elements include an account name input box, a password input box, and a login button; The task script is also used to identify the account name input box and the password input box on the login page, and use the input method to fill the set account name in the account name input box and fill the set password in the password input box; as well as Identify the login button on the login page, and click the login button using the click method.

16. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 13.

17. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 13 is implemented.