CN106681973B - Method and device for automatically filling browser forms in test - Google Patents

Method and device for automatically filling browser forms in test Download PDF

Info

Publication number
CN106681973B
CN106681973B CN201611187682.7A CN201611187682A CN106681973B CN 106681973 B CN106681973 B CN 106681973B CN 201611187682 A CN201611187682 A CN 201611187682A CN 106681973 B CN106681973 B CN 106681973B
Authority
CN
China
Prior art keywords
browser
type
preset information
user
item
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611187682.7A
Other languages
Chinese (zh)
Other versions
CN106681973A (en
Inventor
梁美英
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201611187682.7A priority Critical patent/CN106681973B/en
Publication of CN106681973A publication Critical patent/CN106681973A/en
Application granted granted Critical
Publication of CN106681973B publication Critical patent/CN106681973B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/174Form filling; Merging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • User Interface Of Digital Computer (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method and a device for automatically filling a browser form in a test. The method comprises the following steps: in the application test process, judging whether user preset information exists for a browser form to be filled, and determining the type of each form item in the browser form; if the user preset information exists, filling the user preset information serving as test data into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form; and if the unfilled form items exist in the browser form, generating test data of corresponding types according to the types of the form items for filling. Therefore, according to the invention, the filling information is preset by the user as the test data, and the automatic filling function can be realized for the browser form of the website opened by the browser, so that the complicated operation of manual filling is omitted, and the user experience is enhanced.

Description

Method and device for automatically filling browser forms in test
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for automatically filling a browser form in a test.
Background
In the field of computers, when a user uses a browser, particularly in the process of testing, the user needs to manually fill a browser form to log in a webpage, register information or construct service data to test and the like, so that manual operation is complicated, and user experience is influenced. In the test of the prior art, although the function of automatic filling of the browser form can be partially realized, the function is based on a recording playback mode, that is, the current access address is recorded, manually filled data are statically stored, when the website is accessed again, the manually stored data are played back for automatic filling, the type of filled data cannot be dynamically changed and is effective only for the same accessed website, when a user accesses other websites, manual filling is still needed, automatic filling of the browser forms of all websites opened by the browser cannot be realized, and the user experience is reduced.
Disclosure of Invention
In view of the above, the present invention has been made to provide a method and a corresponding apparatus for enabling automatic filling of browser forms in testing that overcomes or at least partially solves the above mentioned problems.
According to one aspect of the invention, a method for realizing automatic filling of a browser form in test is provided, wherein the method comprises the following steps:
in the application test process, judging whether user preset information exists for a browser form to be filled, and determining the type of each form item in the browser form;
if the user preset information exists, filling the user preset information serving as test data into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form;
and if the unfilled form items exist in the browser form, generating test data of corresponding types according to the types of the form items for filling.
Optionally, the method further comprises:
and if the browser form also has the form item with an unknown type, generating matched test data for filling according to the attribute description information of the form item with the unknown type.
Optionally, the attribute description information of the form item includes: regular expressions of form terms;
the generating and filling of the matched test data according to the attribute description information of the form item with unknown type comprises the following steps: and generating test data conforming to the regular expression according to the regular expression of the form item with unknown type for filling.
Optionally, the attribute description information of the form item includes: the identity and/or name of the form item;
the generating and filling of the matched test data according to the attribute description information of the form item with unknown type comprises the following steps: and generating test data which accords with the literal meaning of the identification and/or the name according to the identification and/or the name of the form item with unknown type for filling.
Optionally, the method further comprises:
providing a user preset information configuration control on a browser page;
when the user preset information configuration control is triggered, outputting a user preset information configuration interface for a user to input user preset information; the method comprises the following steps that input items of an information configuration interface preset by a user correspond to different types;
and correspondingly storing the input content in each input item on the user preset information configuration interface and the type of the corresponding input item to obtain the user preset information.
Optionally, the method further comprises binding the user preset information with the user specified UR L;
for the browser form to be filled, judging whether user preset information exists or not comprises judging whether the user preset information matched with the UR L of the bound UR L and the browser form to be filled exists or not, and if so, determining that the user preset information exists for the browser form to be filled.
Optionally, the determining the type of each form item in the browser form includes:
and identifying the type of the control corresponding to each form item in the browser form through a control identification function of the browser.
Optionally, the method further comprises:
for the form item with unknown type in the browser form, learning the type of the form item according to the content finally filled in the form item, and recording the type of the form item in a form item type learning table;
wherein the test content finally filled into the form item is content manually filled by the user or content randomly generated and filled in.
Optionally, the determining the type of each form item in the browser form further includes:
and determining the type of each form item in the browser form according to the form item type learning table.
According to another aspect of the present invention, there is provided an apparatus for implementing automatic filling of a browser form under test, wherein the apparatus includes:
the pre-processing unit is suitable for judging whether user preset information exists in the browser form to be filled in the application test process and determining the type of each form item in the browser form;
the filling processing unit is suitable for filling the user preset information serving as test data into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form when the user preset information exists; and if the unfilled form items exist in the browser form, generating test data of corresponding types according to the types of the form items for filling.
Optionally, the filling processing unit is further adapted to generate matched test data for filling according to the attribute description information of the form item with unknown type if the form item with unknown type still exists in the browser form.
Optionally, the attribute description information of the form item includes: regular expressions of form terms;
the filling processing unit is suitable for generating test data which accord with the regular expression according to the regular expression of the form item with unknown type for filling.
Optionally, the attribute description information of the form item includes: the identity and/or name of the form item;
and the filling processing unit is suitable for generating test data which accords with the literal meaning of the identification and/or the name according to the identification and/or the name of the form item with unknown type for filling.
Optionally, the apparatus further comprises:
the user preset information processing unit is suitable for providing a user preset information configuration control on a browser page; when the user preset information configuration control is triggered, outputting a user preset information configuration interface for a user to input user preset information; the method comprises the following steps that input items of an information configuration interface preset by a user correspond to different types; and correspondingly storing the input content in each input item on the user preset information configuration interface and the type of the corresponding input item to obtain the user preset information.
Optionally, a user preset information processing unit adapted to bind the user preset information with the user specified UR L;
the preprocessing unit is suitable for judging whether user preset information matched with the UR L of the bound UR L and the browser form to be filled exists or not, and if yes, determining that the user preset information exists in the browser form to be filled.
Optionally, the preprocessing unit is adapted to identify, through a control identification function of the browser, a type of a control corresponding to each form item in the browser form.
Optionally, the apparatus further comprises:
the type learning unit is suitable for learning the type of the form item with unknown type in the browser form according to the content finally filled in the form item and recording the type of the form item into a form item type learning table;
wherein the test content finally filled into the form item is content manually filled by the user or content randomly generated and filled in.
Optionally, the preprocessing unit is further adapted to determine the type of each form item in the browser form according to the form item type learning table.
According to the technical scheme, in the application test process, a user can preset automatic filling information in the browser through a plug-in the browser, when the user tests the browser, whether the user preset information exists in a browser form to be filled is judged, and the type of each form item in the browser form is determined; if the user preset information exists, filling the user preset information into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form; and if the unfilled form items exist in the browser form, generating data of corresponding types according to the types of the form items for filling. In summary, the invention improves the recording playback mode in the test in the prior art, and can realize the automatic filling function for the browser form of the website opened by the browser by using the filling information preset by the user as the test data, thereby saving the complicated operation of manual filling and enhancing the user experience.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 illustrates a flow diagram of a method for implementing auto-populating browser forms, according to one embodiment of the invention;
FIG. 2 is a diagram illustrating an apparatus for implementing automatic filling of browser forms, according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an apparatus for implementing automatic filling of browser forms according to another embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 1 is a flow diagram illustrating a method for implementing auto-populating browser forms under test, according to one embodiment of the invention. As shown in fig. 1, the method includes:
step S110, in the application test process, judging whether the browser form to be filled has user preset information, and determining the type of each form item in the browser form.
The browser form in this step is a filling frame when the user fills information in the browser when using the browser in the application test process, because the filling form is formed in the browser, the filling form appearing when the browser is opened is called the browser form. For example, when a user needs to log in a certain website through a user name, a password and an authentication code, a form filled with information by the user on a login interface is a browser form; or a long form, also called a browser form, when the user fills in basic information when registering a website account.
If the automatic filling function is not available, the user is required to perform manual filling, and for the browser short form, the content required to be filled is less, so that the negative emotion of the user is not caused; however, for a long list of browsers, for example, the amount of information to be filled in during registration is large, and the user experience is greatly reduced by manual filling.
In this step, the user may preset information in the browser, and when the user uses the browser, the information that the user has preset may be automatically filled in the browser form to be filled. Before filling the browser form to be filled, firstly, judging whether user preset information aiming at the browser form to be filled exists or not, if so, preferentially selecting information matched with the types of all form items in the browser form from the preset information to fill in the browser form to be filled.
The method comprises the following steps in a form of user preset information: the user can preset information through the names of the form items of the preset information, for example, the names of the form items can be user names, passwords, mobile phone numbers, identity card numbers, mailboxes, addresses and the like.
The data types corresponding to the respective form items here may be: password field, similar to text box, but the content entered shows dots; radio, radio buttons, such as male or female; checkbox, checkbox; file: upload fields (addressing this type depending on ease); color, defining a color palette; tel, defining the input field of the telephone number; email, defining an input domain of the email; URl, defining an input field containing URl address; search, defining a search domain; number, defining an input field containing a numerical value; range, defining an input containing a range of digital values; date, defining an input domain for selecting days, months and years; month, defining an input domain for selecting the month and the year; week, defining and selecting input fields of weeks and years; time, defining the input domain of the selection time and the second; datetime, defining the input field (UTC time) of the selected time, day, month and year; datatime-local, defining the input field (local time) of the selected time, month and day, year.
It should be noted that if the user does not preset confidential information such as a mobile phone number in the form of the preset information, information corresponding to the data type of the form item may be randomly generated, for example, if the user does not preset a mobile phone number, the first 11 of 1 is randomly generated as a valid number. Meanwhile, the user can also preset the user-defined information through the form of the preset information, and the user can also carry out the top setting operation, so that the user-defined preset information can be preferentially processed.
In order to ensure the correctness of the information automatically filled into the form to be filled, the type of each form item in the browser form to be filled is also required to be determined during automatic filling, and only the preset information with the matched type can be automatically filled.
And step S120, if the user preset information exists, filling the user preset information serving as test data into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form.
The preset information of the user can be used as test data in a browser form, but after the preset information of the user is judged to exist in the browser, whether the types of all form items of the form in the browser to be filled are matched with the types of the preset information or not needs to be judged, and automatic filling can be performed only under the condition that the types of all form items are matched with the types of the preset information. For example, a certain browser form to be filled has a form item of "telephone number", the type of which is an input field of the telephone number, and if the preset information type matched with the form item of "telephone number" exists in the preset information of the user, the browser form is automatically filled; if there is no preset information type matching the "phone number" form entry, then automatic filling is not possible.
Step S130, if the table items which are not filled exist in the browser table, test data of corresponding types are generated according to the types of the table items for filling.
If the form item which does not match with the type of the preset information exists in the browser form and is not automatically filled, the test data which matches with the form item can be randomly generated according to the type of each unfilled form item for random filling. Because some information filled in the browser form is not necessarily true for the testing process, as long as the data format is correct. For example, the random generation here may be: (1) generating a mobile phone number: the first bit is 1; the second bit is any bit of 3/4/5/7/8; the last 9 bits are randomly generated to be 0-9 digits. (2) Generating an identification number (ABCDEFEYYYYMMDDXXXR): a six-digit digital address code; an eight-bit digital birth date code; a three digit sequential code; a one-bit digital check code. (3) Generating a mailbox: randomly generating a user name; username + random mailbox suffix array. (4) Randomly generating url: http www + lowercase random string + random domain name.
If the random population is correct, the user can directly determine, and if the population is incorrect, the user can cancel the random generation again, or the user can directly and manually fill in the correct data.
Therefore, the invention improves the recording playback mode in the test in the prior art, and can realize the automatic filling function on the browser form of the website opened by the browser by using the filling information preset by the user as the test data, thereby saving the complicated operation of manual filling and enhancing the user experience.
In a case that the type of each form item in the browser form to be filled is known, and if there are also form items of unknown types in the browser form to be filled, in an embodiment of the present invention, the method shown in fig. 1 further includes: and if the browser form also has the form item with an unknown type, generating matched test data for filling according to the attribute description information of the form item with the unknown type. The attribute description information here may be: regular expressions of form items, and identifications and/or names of form items. Regular expressions, also called regular expressions, are generally used to retrieve and replace text that conforms to a certain pattern (rule), and here, may refer to a rule of data filled in a form item, and according to the rule, the form of the data filled in the form item may be known. Therefore, when the attribute description information of the form item includes:
(1) regular expressions of form terms.
Generating matched test data for filling according to the attribute description information of the form item with unknown type comprises the following steps: and generating test data conforming to the regular expression according to the regular expression of the form item with unknown type for filling. Js can generate data conforming to the regular expression from date _ type here by randexp. For example, if the regular expression of a certain form term is D1, a number is generated; if it is S1, a character is generated; if it is S1-S9, a string of nine characters is generated.
(2) Identification and/or name of the form item.
Generating matched test data for filling according to the attribute description information of the form item with unknown type comprises the following steps: and generating test data which accords with the literal meaning of the identification and/or the name according to the identification and/or the name of the form item with unknown type for filling. That is, the name of the form entry is analyzed and the like to identify the form entry for padding. For example, if the name of the form item is "mail", the form item may be filled with data in the mail format.
The identification of the form entry here may be: a username (name); password (password); the certificate number cardcode; mailbox email; mobile phone number mobile No.; age; company, etc.
According to the invention, a user can preset information to automatically fill the browser form in the browser, and the user can preset the information through the preset information plug-in the browser. In one embodiment of the present invention, the method shown in fig. 1 further comprises: providing a user preset information configuration control on a browser page, for example, adding a preset information configuration control in a 'setting' option of a browser; when the user preset information configuration control is triggered, for example, a user clicks the configuration control through a right mouse button, a user preset information configuration interface is output, and when the user clicks one input box in the corresponding preset information configuration interface through a left mouse button again, the user is allowed to input user preset information; the method comprises the following steps that input items of an information configuration interface preset by a user correspond to different types; in order to match with the types of all form items in the browser form to be filled during automatic filling, the input content in all input items on the user preset information configuration interface is corresponding to the types of the corresponding input items and is stored at the same time, and user preset information is obtained.
If the user does not want the browser forms of all websites in the browser to be automatically filled through the preset information or some specified preset information needs to be automatically filled into some specified websites, the user can set the website address UR L for some preset information or all preset information during the preset information, further, the method further comprises the steps of binding the user preset information with the UR L specified by the user, judging whether the user preset information exists for the browser forms to be filled, and judging whether the bound UR L is matched with the UR L of the browser forms to be filled, if so, determining that the user preset information exists for the browser forms to be filled, otherwise, the user preset information does not exist.
In the browser, each form item in the browser form has a respective control, the control can control filling and content judgment of each form item, and the control records the type of each form item. Therefore, in one embodiment of the present invention, the determining the type of each form item in the browser form in step S110 includes: and identifying the type of the control corresponding to each form item in the browser form through a control identification function of the browser.
In order to prevent the other browser forms to be filled in the browser from appearing again with form items of unknown types, in one embodiment of the present invention, the method shown in fig. 1 further comprises: and for the list item with unknown type in the browser list, learning the type of the list item according to the content finally filled in the list item, and recording the type of the list item in a list item type learning table. After automatic filling, if the form item with unknown type exists in the browser form to be filled, a learning process is needed, and information such as final filling data of the corresponding form item is recorded. The data finally filled here is the data that finally confirms the correctness. The filling of the form item with unknown type can be randomly generated, or manually filled by the user directly, or manually filled by the user after the random generation is incorrect, so that the test content finally filled into the form item is the content manually filled by the user or the content which is randomly generated and filled.
Then, determining the type of each form item in the browser form in step S110 further comprises: and determining the type of each form item in the browser form according to the form item type learning table.
Fig. 2 is a schematic diagram of an apparatus for implementing automatic filling of browser forms under test according to an embodiment of the present invention. As shown in fig. 2, the apparatus 200 for implementing automatic filling of browser forms includes:
the preprocessing unit 210 is adapted to, in the application test process, determine whether there is user preset information for the browser form to be filled, and determine the type of each form item in the browser form.
The browser form is a filling frame used when a user fills information in a browser when using the browser in an application test process, and is a filling form formed in the browser, and the filling form appearing when the browser is opened is called the browser form. For example, when a user needs to log in a certain website through a user name, a password and an authentication code, a form filled with information by the user on a login interface is a browser form; or a long form, also called a browser form, when the user fills in basic information when registering a website account.
If the automatic filling function is not available, the user is required to perform manual filling, and for the browser short form, the content required to be filled is less, so that the negative emotion of the user is not caused; however, for a long list of a browser, if the amount of information to be filled in during registration is large, the user experience is greatly reduced through manual filling.
In the unit, a user can preset information in a browser, and when the user uses the browser, the information preset by the user can be automatically filled in a browser form to be filled. Before filling the browser form to be filled, firstly, judging whether user preset information aiming at the browser form to be filled exists or not, if so, preferentially selecting information matched with the types of all form items in the browser form from the preset information to fill in the browser form to be filled.
The method comprises the following steps in a form of user preset information: the user can preset information through the names of the form items of the preset information, for example, the names of the form items can be user names, passwords, mobile phone numbers, identity card numbers, mailboxes, addresses and the like.
The data types corresponding to the respective form items here may be: password field, similar to text box, but the content entered shows dots; radio, radio buttons, such as male or female; checkbox, checkbox; file: upload fields (addressing this type depending on ease); color, defining a color palette; tel, defining the input field of the telephone number; email, defining an input domain of the email; URl, defining an input field containing URl address; search, defining a search domain; number, defining an input field containing a numerical value; range, defining an input containing a range of digital values; date, defining an input domain for selecting days, months and years; month, defining an input domain for selecting the month and the year; week, defining and selecting input fields of weeks and years; time, defining the input domain of the selection time and the second; datetime, defining the input field (UTC time) of the selected time, day, month and year; datatime-local, defining the input field (local time) of the selected time, month and day, year.
It should be noted that if the user does not preset confidential information such as a mobile phone number in the form of the preset information, information corresponding to the data type of the form item may be randomly generated, for example, if the user does not preset a mobile phone number, the first 11 of 1 is randomly generated as a valid number. Meanwhile, the user can also preset the user-defined information through the form of the preset information, and the user can also carry out the top setting operation, so that the user-defined preset information can be preferentially processed.
In order to ensure the correctness of the information automatically filled into the form to be filled, the type of each form item in the browser form to be filled is also required to be determined during automatic filling, and only the preset information with the matched type can be automatically filled.
The filling processing unit 220 is adapted to fill the user preset information serving as test data into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form when the user preset information exists; and if the unfilled form items exist in the browser form, generating test data of corresponding types according to the types of the form items for filling.
The preset information of the user can be used as test data in a browser form, but after the preset information of the user is judged to exist in the browser, whether the types of all form items of the form in the browser to be filled are matched with the types of the preset information or not needs to be judged, and automatic filling can be performed only under the condition that the types of all form items are matched with the types of the preset information. For example, a certain browser form to be filled has a form item of "telephone number", the type of which is an input field of the telephone number, and if the preset information type matched with the form item of "telephone number" exists in the preset information of the user, the browser form is automatically filled; if there is no preset information type matching the "phone number" form entry, then automatic filling is not possible.
If the form item which does not match with the type of the preset information exists in the browser form and is not automatically filled, the test data which matches with the form item can be randomly generated according to the type of each unfilled form item for random filling. Because some information filled in the browser form is not necessarily true for the testing process, as long as the data format is correct. For example, the random generation here may be: (1) generating a mobile phone number: the first bit is 1; the second bit is any bit of 3/4/5/7/8; the last 9 bits are randomly generated to be 0-9 digits. (2) Generating an identification number (ABCDEFEYYYYMMDDXXXR): a six-digit digital address code; an eight-bit digital birth date code; a three digit sequential code; a one-bit digital check code. (3) Generating a mailbox: randomly generating a user name; username + random mailbox suffix array. (4) Randomly generating url: http www + lowercase random string + random domain name.
If the random population is correct, the user can directly determine, and if the population is incorrect, the user can cancel the random generation again, or the user can directly and manually fill in the correct data.
Therefore, the invention improves the recording playback mode in the test in the prior art, and can realize the automatic filling function on the browser form of the website opened by the browser by using the filling information preset by the user as the test data, thereby saving the complicated operation of manual filling and enhancing the user experience.
In a case that the type of each form item in the browser form is known, and if there is another form item with an unknown type in the browser form to be filled, the filling processing unit 220 is further adapted to generate matching test data for filling according to the attribute description information of the form item with the unknown type in an embodiment of the present invention, if there is another form item with an unknown type in the browser form. The attribute description information here may be: regular expressions of form items, and identifications and/or names of form items. Regular expressions, also called regular expressions, are generally used to retrieve and replace text that conforms to a certain pattern (rule), and here, may refer to a rule of data filled in a form item, and according to the rule, the form of the data filled in the form item may be known. Therefore, when the attribute description information of the form item includes:
(1) regular expressions of form terms.
The filling processing unit 220 is adapted to generate test data conforming to the regular expression according to the regular expression of the form item with unknown type for filling. Js can generate data conforming to the regular expression from date _ type here by randexp. For example, if the regular expression of a certain form term is D1, a number is generated; if it is S1, a character is generated; if it is S1-S9, a string of nine characters is generated.
(2) Identification and/or name of the form item.
The filling processing unit 220 is adapted to generate test data conforming to the literal meaning of the identifier and/or name according to the identifier and/or name of the form item with unknown type for filling. That is, the name of the form entry is analyzed and the like to identify the form entry for padding. For example, if the name of the form item is "mail", the form item may be filled with data in the mail format.
The identification of the form entry here may be: a username (name); password (password); the certificate number cardcode; mailbox email; mobile phone number mobile No.; age; company, etc.
Fig. 3 is a schematic diagram of an apparatus for implementing automatic filling of browser forms according to another embodiment of the present invention. As shown in fig. 3, the apparatus 300 for implementing automatic filling of browser forms includes: a preprocessing unit 310, a padding processing unit 320, a user preset information processing unit 330, and a type learning unit 340. The preprocessing unit 310 and the padding processing unit 320 have the same functions as the preprocessing unit 210 and the padding processing unit 220 shown in fig. 2, and the description of the same parts is omitted here.
According to the invention, a user can preset information to automatically fill the browser form in the browser, and the user can preset the information through the preset information plug-in the browser. Therefore, the user preset information processing unit 330 is adapted to provide a user preset information configuration control on the browser page, for example, add a preset information configuration control in a "set" option of the browser; when the user preset information configuration control is triggered, for example, a user clicks the configuration control through a right mouse button, a user preset information configuration interface is output, and when the user clicks one input box in the corresponding preset information configuration interface through a left mouse button again, the user is allowed to input user preset information; the method comprises the following steps that input items of an information configuration interface preset by a user correspond to different types; and correspondingly storing the input content in each input item on the user preset information configuration interface and the type of the corresponding input item to obtain the user preset information.
If the user does not want the browser forms of all the websites in the browser to be automatically filled through the preset information, or some specified preset information needs to be automatically filled into some specified websites, the user may set the website address UR L for some preset information or for all preset information when the information is preset, and further, the user preset information processing unit 330 is adapted to bind the user preset information with the user specified UR L.
The preprocessing unit 310 is adapted to determine whether there is user preset information matching the bound UR L with the UR L of the browser form to be filled, if so, it is determined that there is user preset information for the browser form to be filled, otherwise, there is no user preset information.
In the browser, each form item in the browser form has a respective control, the control can control filling and content judgment of each form item, and the control records the type of each form item. Therefore, in an embodiment of the present invention, the preprocessing unit 310 is adapted to identify, through a control identification function of the browser, a type of a control corresponding to each form item in the browser form.
In order to prevent the other browser forms to be filled in the browser from appearing again with the form items of unknown types, in an embodiment of the present invention, the type learning unit 340 in the apparatus 300 for implementing automatic filling of the browser forms is adapted to, for the form items of unknown types in the browser forms, learn the type of the form items according to the contents finally filled in the form items, and record the type of the form items in the form item type learning table. After automatic filling, if the form item with unknown type exists in the browser form to be filled, a learning process is needed, and information such as final filling data of the corresponding form item is recorded. The data finally filled here is the data that finally confirms the correctness.
The filling of the form item with unknown type can be randomly generated, or manually filled by the user directly, or manually filled by the user after the random generation is incorrect, so that the content finally filled into the form item is the test content manually filled by the user or the randomly generated and filled content.
Then, in an embodiment of the present invention, the preprocessing unit 310 is further adapted to determine the type of each form item in the browser form according to the form item type learning table.
In summary, according to the technical scheme of the present invention, in the application test process, a user may preset automatically filled information in a browser through a plug-in the browser, and when the user tests the browser, it is determined whether there is user preset information for a browser form to be filled, and a type of each form item in the browser form is determined; if the user preset information exists, filling the user preset information into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form; and if the unfilled form items exist in the browser form, generating data of corresponding types according to the types of the form items for filling. Therefore, the invention improves the recording playback mode in the test in the prior art, and can realize the automatic filling function on the browser form of the website opened by the browser by using the filling information preset by the user as the test data, thereby saving the complicated operation of manual filling and enhancing the user experience.
It should be noted that:
the algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose devices may be used with the teachings herein. The required structure for constructing such a device will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of an apparatus for automatically populating browser forms according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
The invention discloses A1 and a method for automatically filling browser forms in testing, wherein the method comprises the following steps:
in the application test process, judging whether user preset information exists for a browser form to be filled, and determining the type of each form item in the browser form;
if the user preset information exists, filling the user preset information serving as test data into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form;
and if the unfilled form items exist in the browser form, generating test data of corresponding types according to the types of the form items for filling.
A2, the method of a1, wherein the method further comprises:
and if the browser form also has the form item with an unknown type, generating matched test data for filling according to the attribute description information of the form item with the unknown type.
A3 the method of A2, wherein,
the attribute description information of the form item includes: regular expressions of form terms;
the generating and filling of the matched test data according to the attribute description information of the form item with unknown type comprises the following steps: and generating test data conforming to the regular expression according to the regular expression of the form item with unknown type for filling.
A4 the method of A2, wherein,
the attribute description information of the form item includes: the identity and/or name of the form item;
the generating and filling of the matched test data according to the attribute description information of the form item with unknown type comprises the following steps: and generating test data which accords with the literal meaning of the identification and/or the name according to the identification and/or the name of the form item with unknown type for filling.
A5, the method of a1, wherein the method further comprises:
providing a user preset information configuration control on a browser page;
when the user preset information configuration control is triggered, outputting a user preset information configuration interface for a user to input user preset information; the method comprises the following steps that input items of an information configuration interface preset by a user correspond to different types;
and correspondingly storing the input content in each input item on the user preset information configuration interface and the type of the corresponding input item to obtain the user preset information.
A6 the method of A5, wherein,
the method further includes binding the user preset information with the user specified UR L;
for the browser form to be filled, judging whether user preset information exists or not comprises judging whether the user preset information matched with the UR L of the bound UR L and the browser form to be filled exists or not, and if so, determining that the user preset information exists for the browser form to be filled.
A7, the method of A1, wherein the determining the type of each form item in the browser form comprises:
and identifying the type of the control corresponding to each form item in the browser form through a control identification function of the browser.
A8, the method of a1, wherein the method further comprises:
for the form item with unknown type in the browser form, learning the type of the form item according to the content finally filled in the form item, and recording the type of the form item in a form item type learning table;
wherein the test content finally filled into the form item is content manually filled by the user or content randomly generated and filled in.
A9, the method of A8, wherein the determining the type of each form item in the browser form further comprises:
and determining the type of each form item in the browser form according to the form item type learning table.
The invention also discloses B10, a device for automatically filling browser forms in testing, wherein the device comprises:
the pre-processing unit is suitable for judging whether user preset information exists in the browser form to be filled in the application test process and determining the type of each form item in the browser form;
the filling processing unit is suitable for filling the user preset information serving as test data into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form when the user preset information exists; and if the unfilled form items exist in the browser form, generating test data of corresponding types according to the types of the form items for filling.
B11, the device of B10, wherein,
and the filling processing unit is further suitable for generating matched test data for filling according to the attribute description information of the form item with unknown type if the form item with unknown type still exists in the browser form.
B12, the device of B11, wherein,
the attribute description information of the form item includes: regular expressions of form terms;
the filling processing unit is suitable for generating test data which accord with the regular expression according to the regular expression of the form item with unknown type for filling.
B13, the device of B11, wherein,
the attribute description information of the form item includes: the identity and/or name of the form item;
and the filling processing unit is suitable for generating test data which accords with the literal meaning of the identification and/or the name according to the identification and/or the name of the form item with unknown type for filling.
B14, the apparatus of B10, wherein the apparatus further comprises:
the user preset information processing unit is suitable for providing a user preset information configuration control on a browser page; when the user preset information configuration control is triggered, outputting a user preset information configuration interface for a user to input user preset information; the method comprises the following steps that input items of an information configuration interface preset by a user correspond to different types; and correspondingly storing the input content in each input item on the user preset information configuration interface and the type of the corresponding input item to obtain the user preset information.
B15, the device of B14, wherein,
a user preset information processing unit adapted to bind user preset information with the user specified UR L;
the preprocessing unit is suitable for judging whether the bound UR L and the user preset information matched with the UR L of the browser form to be filled exist or not, and if yes, determining that the user preset information exists in the browser form to be filled.
B16, the device of B10, wherein,
the preprocessing unit is suitable for identifying the type of the control corresponding to each form item in the browser form through the control identification function of the browser.
B17, the apparatus of B10, wherein the apparatus further comprises:
the type learning unit is suitable for learning the type of the form item with unknown type in the browser form according to the content finally filled in the form item and recording the type of the form item into a form item type learning table;
wherein the test content finally filled into the form item is content manually filled by the user or content randomly generated and filled in.
B18, the device of B17, wherein,
the preprocessing unit is further suitable for determining the type of each form item in the browser form according to the form item type learning table.

Claims (14)

1. A method for realizing automatic filling of browser forms in testing is provided, wherein the method comprises the following steps:
in the application test process, judging whether user preset information exists for a browser form to be filled, and determining the type of each form item in the browser form;
if the user preset information exists, filling the user preset information serving as test data into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form;
if unfilled form items exist in the browser form, test data of corresponding types are generated according to the types of the form items for filling;
the method further comprises the following steps:
if the browser form also has the form item with unknown type, generating matched test data for filling according to the attribute description information of the form item with unknown type;
the attribute description information of the form item includes: regular expressions of form terms;
the generating and filling of the matched test data according to the attribute description information of the form item with unknown type comprises the following steps: and generating test data conforming to the regular expression according to the regular expression of the form item with unknown type for filling.
2. The method of claim 1, wherein,
the attribute description information of the form item includes: the identity and/or name of the form item;
the generating and filling of the matched test data according to the attribute description information of the form item with unknown type comprises the following steps: and generating test data which accords with the literal meaning of the identification and/or the name according to the identification and/or the name of the form item with unknown type for filling.
3. The method of claim 1, wherein the method further comprises:
providing a user preset information configuration control on a browser page;
when the user preset information configuration control is triggered, outputting a user preset information configuration interface for a user to input user preset information; the method comprises the following steps that input items of an information configuration interface preset by a user correspond to different types;
and correspondingly storing the input content in each input item on the user preset information configuration interface and the type of the corresponding input item to obtain the user preset information.
4. The method of claim 3, wherein,
the method further includes binding the user preset information with the user specified UR L;
for the browser form to be filled, judging whether user preset information exists or not comprises judging whether the user preset information matched with the UR L of the bound UR L and the browser form to be filled exists or not, and if so, determining that the user preset information exists for the browser form to be filled.
5. The method of claim 1, wherein the determining the type of each form item in the browser form comprises:
and identifying the type of the control corresponding to each form item in the browser form through a control identification function of the browser.
6. The method of claim 1, wherein the method further comprises:
for the form item with unknown type in the browser form, learning the type of the form item according to the content finally filled in the form item, and recording the type of the form item in a form item type learning table;
wherein the test content finally filled into the form item is content manually filled by the user or content randomly generated and filled in.
7. The method of claim 6, wherein the determining the type of each form item in the browser form further comprises:
and determining the type of each form item in the browser form according to the form item type learning table.
8. An apparatus for implementing automatic filling of browser forms in a test, wherein the apparatus comprises:
the pre-processing unit is suitable for judging whether user preset information exists in the browser form to be filled in the application test process and determining the type of each form item in the browser form;
the filling processing unit is suitable for filling the user preset information serving as test data into the form items with the matched types according to the type of the user preset information and the type of each form item in the browser form when the user preset information exists; if unfilled form items exist in the browser form, test data of corresponding types are generated according to the types of the form items for filling;
the filling processing unit is further suitable for generating matched test data for filling according to the attribute description information of the form item with unknown type if the form item with unknown type still exists in the browser form;
the attribute description information of the form item includes: regular expressions of form terms;
the filling processing unit is suitable for generating test data which accord with the regular expression according to the regular expression of the form item with unknown type for filling.
9. The apparatus of claim 8, wherein,
the attribute description information of the form item includes: the identity and/or name of the form item;
and the filling processing unit is suitable for generating test data which accords with the literal meaning of the identification and/or the name according to the identification and/or the name of the form item with unknown type for filling.
10. The apparatus of claim 8, wherein the apparatus further comprises:
the user preset information processing unit is suitable for providing a user preset information configuration control on a browser page; when the user preset information configuration control is triggered, outputting a user preset information configuration interface for a user to input user preset information; the method comprises the following steps that input items of an information configuration interface preset by a user correspond to different types; and correspondingly storing the input content in each input item on the user preset information configuration interface and the type of the corresponding input item to obtain the user preset information.
11. The apparatus of claim 10, wherein,
a user preset information processing unit adapted to bind user preset information with the user specified UR L;
the preprocessing unit is suitable for judging whether the bound UR L and the user preset information matched with the UR L of the browser form to be filled exist or not, and if yes, determining that the user preset information exists in the browser form to be filled.
12. The apparatus of claim 8, wherein,
the preprocessing unit is suitable for identifying the type of the control corresponding to each form item in the browser form through the control identification function of the browser.
13. The apparatus of claim 8, wherein the apparatus further comprises:
the type learning unit is suitable for learning the type of the form item with unknown type in the browser form according to the content finally filled in the form item and recording the type of the form item into a form item type learning table;
wherein the test content finally filled into the form item is content manually filled by the user or content randomly generated and filled in.
14. The apparatus of claim 13, wherein,
the preprocessing unit is further suitable for determining the type of each form item in the browser form according to the form item type learning table.
CN201611187682.7A 2016-12-20 2016-12-20 Method and device for automatically filling browser forms in test Active CN106681973B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611187682.7A CN106681973B (en) 2016-12-20 2016-12-20 Method and device for automatically filling browser forms in test

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611187682.7A CN106681973B (en) 2016-12-20 2016-12-20 Method and device for automatically filling browser forms in test

Publications (2)

Publication Number Publication Date
CN106681973A CN106681973A (en) 2017-05-17
CN106681973B true CN106681973B (en) 2020-07-24

Family

ID=58869983

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611187682.7A Active CN106681973B (en) 2016-12-20 2016-12-20 Method and device for automatically filling browser forms in test

Country Status (1)

Country Link
CN (1) CN106681973B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107102978B (en) * 2017-05-24 2020-11-24 北京星选科技有限公司 Data backfilling method and device and mobile terminal
CN107357562B (en) * 2017-05-24 2023-09-05 青岛海信移动通信技术股份有限公司 Information filling method, device and client
CN107704104B (en) * 2017-10-11 2021-04-30 携程旅游信息技术(上海)有限公司 Form input item association method, system, device and storage medium
TWI661349B (en) * 2017-11-15 2019-06-01 財團法人資訊工業策進會 Method and system for generating conversational user interface
CN108399128A (en) * 2018-02-28 2018-08-14 深圳前海桔子信息技术有限公司 A kind of generation method of user data, device, server and storage medium
CN108563618A (en) * 2018-03-15 2018-09-21 链家网(北京)科技有限公司 Change method and system on a kind of paper document line
CN109710534B (en) * 2018-12-29 2022-01-11 北京航天云路有限公司 Form real-time monitoring and checking method and system based on custom attribute
CN111597108B (en) * 2020-04-23 2024-06-25 平安国际智慧城市科技股份有限公司 Form attribute testing method and device and computer readable storage medium
CN112330277A (en) * 2020-11-03 2021-02-05 唐山恒智天成科技有限公司 Engineering data management system and management method
CN113076728A (en) * 2021-03-12 2021-07-06 武汉木仓科技股份有限公司 Data filling method of dialog box and related equipment
CN112835809A (en) * 2021-03-22 2021-05-25 亿企赢网络科技有限公司 Test data setting method, device, equipment and medium based on browser
CN113920333B (en) * 2021-09-01 2022-09-23 广州云硕科技发展有限公司 Intelligent management method and system for improving resident experience degree

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101369271A (en) * 2007-08-17 2009-02-18 徐萍 Automatic filling mark module and its browser assembly
CN103581212A (en) * 2012-07-18 2014-02-12 百度在线网络技术(北京)有限公司 Automatic form filling method, system and device based on cloud analysis
CN104182467A (en) * 2014-07-21 2014-12-03 安徽华贞信息科技有限公司 Network data source detection method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101369271A (en) * 2007-08-17 2009-02-18 徐萍 Automatic filling mark module and its browser assembly
CN103581212A (en) * 2012-07-18 2014-02-12 百度在线网络技术(北京)有限公司 Automatic form filling method, system and device based on cloud analysis
CN104182467A (en) * 2014-07-21 2014-12-03 安徽华贞信息科技有限公司 Network data source detection method

Also Published As

Publication number Publication date
CN106681973A (en) 2017-05-17

Similar Documents

Publication Publication Date Title
CN106681973B (en) Method and device for automatically filling browser forms in test
CN108156237B (en) Product information pushing method and device, storage medium and computer equipment
US10013411B2 (en) Automating data entry for fields in electronic documents
US8839448B2 (en) Generation of a human readable output message in a format that is unreadable by a computer-based device
CN107909471A (en) A kind of method, apparatus of business processing, self-help terminal equipment and storage medium
US9984386B1 (en) Rules recommendation based on customer feedback
US20080016064A1 (en) Online delivery platform and method of legacy works of authorship
JP7029003B2 (en) Password protection Question setting method and device
CN106961420A (en) The processing method and processing device of cookie information
CN104158828B (en) The method and system of suspicious fishing webpage are identified based on cloud content rule base
CN107908959A (en) Site information detection method, device, electronic equipment and storage medium
CN107832275A (en) The generation method of intelligent Contract ID, apparatus and system in block chain
US9769273B2 (en) System and method for automatic configuration of domain names for third party services
CN103618807A (en) Method and device for processing cookie information
US10341323B1 (en) Automated method for on demand multifactor authentication
US20210133645A1 (en) Automated generation of documents and labels for use with machine learning systems
CN110414989A (en) Method for detecting abnormality and device, electronic equipment and computer readable storage medium
US20220222760A1 (en) Asset Verification Systems and/or Methods
CN110058992B (en) Text template effect feedback method and device and electronic equipment
CN111598707B (en) Page generation method and electronic equipment
CN111047146B (en) Risk identification method, device and equipment for enterprise users
CN109800556A (en) A kind of e-platform system
US20190058687A1 (en) Personal web address management system
CN111428463A (en) Short message processing method and device, electronic equipment and storage medium
CN104361094A (en) Storage method and device for file in search result, and browser client

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant