CN107577592B - Webpage element positioning method and device - Google Patents

Webpage element positioning method and device Download PDF

Info

Publication number
CN107577592B
CN107577592B CN201610520639.1A CN201610520639A CN107577592B CN 107577592 B CN107577592 B CN 107577592B CN 201610520639 A CN201610520639 A CN 201610520639A CN 107577592 B CN107577592 B CN 107577592B
Authority
CN
China
Prior art keywords
positioning
webpage
locator
character string
keywords
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
CN201610520639.1A
Other languages
Chinese (zh)
Other versions
CN107577592A (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 CN201610520639.1A priority Critical patent/CN107577592B/en
Publication of CN107577592A publication Critical patent/CN107577592A/en
Application granted granted Critical
Publication of CN107577592B publication Critical patent/CN107577592B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a method and a device for positioning webpage elements, wherein the method comprises the following steps: receiving an input character string containing positioning keywords, wherein the positioning keywords are derived from characters displayed in a webpage; judging whether the character string contains a position locator or not, wherein the position locator is used for indicating the relative position of a positioning keyword and a webpage element to be positioned; if the character string does not contain the position locator, traversing the webpage elements matched with the positioning keywords in the webpage; if the character string contains the position locator, searching the webpage element consistent with the relative position of the positioning key word and the position locator indication. According to the method and the device for positioning the webpage elements, when the webpage elements are positioned, the positioning of the webpage elements can be realized directly according to the positioning keywords, the position locators and other information in the webpage, the limitation that the positioning can be performed only by reading codes is eliminated, and the method and the device are simple and easy to perform.

Description

Webpage element positioning method and device
Technical Field
The invention relates to the field of computer software, in particular to a method and a device for positioning webpage elements.
Background
When testing a webpage, testing each element in the webpage is required. It is first necessary to find an element and locate it in order to accurately obtain the information of the element. The element may then be tested, such as setting display content for the element, clicking on the element, and the like.
In the prior art, automatic testing tools such as WebDriver and the like are adopted, so that the positioning of elements in the webpage can be realized. However, webDriver or other automated test tools need to know the information of the element, such as the id, name, etc. of the element when locating the element. The information users have to find out the definition of the elements in the web page by looking at the html, js and other codes of the web page, and obtain the information such as the ids of the elements from the codes. For users, the user needs to know the languages such as html, js and the like, which makes the test work limited and cannot be popularized.
Disclosure of Invention
In view of the foregoing, the present invention is directed to a method and apparatus for locating web page elements that overcomes or at least partially solves the foregoing problems.
According to one aspect of the present invention, there is provided a method for locating a web page element, including:
receiving an input character string containing positioning keywords, wherein the positioning keywords are derived from characters displayed in a webpage;
Judging whether the character string contains a position locator or not, wherein the position locator is used for indicating the relative position of a positioning keyword and a webpage element to be positioned;
if the character string does not contain the position locator, traversing the webpage elements matched with the positioning keywords in the webpage;
if the character string contains the position locator, searching the webpage element consistent with the relative position of the positioning key word and the position locator indication.
According to another aspect of the present invention, there is provided a positioning device for a web page element, including:
The receiving module is suitable for receiving an input character string containing positioning keywords, wherein the positioning keywords are derived from characters displayed in the webpage;
the locator judging module is suitable for judging whether the character string contains a location locator or not, wherein the location locator is used for indicating the relative position of the locating keyword and the webpage element to be located;
the element traversing module is suitable for traversing the webpage elements matched with the positioning keywords in the webpage if the character string does not contain the position locator;
and the locator searching module is suitable for searching the webpage element consistent with the relative position of the positioning keyword and the indication of the position locator if the character string contains the position locator.
According to the webpage element positioning method and device provided by the invention, the input character string containing the positioning keywords is received, and the webpage elements matched with the positioning keywords can be positioned in a traversing manner. Further, when the position locator is specified, the web page element consistent with the relative position of the positioning keyword and the position locator indication is searched, and the web page element can be accurately positioned. When the webpage elements are positioned, the definition of the elements in the webpage codes is found without looking at the html, js and other codes in the webpage. The method can directly realize the positioning of the webpage elements from various information such as characters, position relations and the like displayed on the webpage, gets rid of the limitation that the positioning can be performed only by reading codes, and is simple and easy to execute.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
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 designate like parts throughout the figures. In the drawings:
FIG. 1 illustrates a flow chart of a method of locating web page elements according to one embodiment of the invention;
FIG. 2 shows a schematic diagram of a login page;
FIG. 3 shows a schematic diagram of a user information entry web page;
FIG. 4 is a flow chart illustrating a method of locating a web page element according to another embodiment of the invention;
FIG. 5 illustrates a functional block diagram of a web page element locating apparatus according to one embodiment of the invention;
FIG. 6 illustrates a functional block diagram of a web page element locating apparatus 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.
When testing a webpage, testing each element in the webpage, such as inputting a frame element, testing correct display characters, limiting the length of the display characters and the like; multiple selection boxes or single selection box elements need to be tested for selecting or canceling functions; a link element, which needs to test a link clicking function; button elements, click functions that require test buttons, etc. Different elements all need to test different functional implementations.
FIG. 1 illustrates a flow chart of a method of locating web page elements according to one embodiment of the invention. As shown in fig. 1, the positioning method of the web page element specifically includes the following steps:
Step S101, an input character string containing a positioning keyword is received.
The web page includes a number of elements including an input box element for input, a button element, an element for providing link skip, a selection box element, text for prompting information, and the like. The login web page shown in fig. 2 displays prompt information characters such as a user name, a password, a user name and the like, corresponding input frame elements and radio frame elements are arranged beside the characters, and the web page also comprises button elements such as login, cancel and the like and a link element which returns to the upper page. The positioning keywords are derived from characters displayed in the webpage and can be characters used for prompting information, such as user names, passwords and the like; text in the link element, such as return to the upper page, is also possible; but also the text displayed by the button element, such as cancellation. Further, the positioning key may be part of the text displayed in the web page, such as a return.
And determining a positioning keyword according to the webpage element to be positioned, wherein the positioning keyword is related to the webpage element to be positioned. If the webpage element to be positioned is the input box of the password, the positioning keyword can be set as the password or the password. If the webpage element to be located is a login button, the location keyword may be set to be logged in. If the web page element to be located is a link element, the locating key word can be set to return to the upper page or return.
Step S102, judging whether the character string contains a position locator.
The character string may include a position locator in addition to the positioning keyword. The position locator is used for indicating the relative position of the positioning keyword and the webpage element to be positioned. As shown in fig. 2, when the web page element to be positioned is the input frame of the password, the position locator is the relative position of the password text and the input frame of the password when the positioning keyword is set as the password, the password input frame is on the right side of the password text, and the position locator is on the right side; when the positioning key words are set to memorize the user names, the position locator is the relative position of an input box for memorizing the user name characters and the passwords, the password input box is arranged on the upper side for memorizing the user name characters, and the position locator is arranged on the upper side. When the webpage element to be positioned is a login button, the positioning key word is set to be in the same position as the login button, so that a position locator is not required to be set; when the positioning key is set to cancel, the login button is on the left side of the canceling text, and the position locator is on the left side.
Judging whether the character string contains the position locator, if so, executing step S104, otherwise, executing step S103.
Step S103, traversing the webpage elements matched with the positioning keywords in the webpage.
And traversing the webpage elements in the webpage, and searching the webpage elements matched with the positioning keywords. When a webpage element login button is positioned through positioning keyword login, generating an object of a login webpage aiming at a website of the login webpage, traversing elements in the webpage object, and searching for the webpage element matched with the login.
Step S104, searching the web page elements consistent with the relative position of the positioning key words and the position locator indication.
When the character string contains the position locator, the search needs to search the web page element consistent with the relative position of the positioning key words and the indication of the position locator. The location of the locating key can be found by looking up the locating key, and further, the web page element located on the side indicated by the location locator of the locating key is looked up. If the element to be positioned is a user name input box, the user name input box element can be positioned by searching the position of the user name positioning keyword and searching the webpage element positioned on the right side of the user name positioning keyword.
When a plurality of webpage elements consistent with the relative positions of the positioning keywords and the position locator indication are searched, as shown in fig. 3, the webpage element to be positioned is a city input frame, the positioning keywords are searched as detailed addresses, and when the position locator is on the right side, the webpage element positioned on the right side of the detailed addresses is searched, so that the plurality of webpage elements of the city input frame, the district input frame and the county input frame can be found, and the webpage element with the nearest position distance to the positioning keywords is needed to be taken as the webpage element to be positioned. The coordinate data of a plurality of webpage elements of the city input frame, the district input frame and the county input frame are compared with the coordinate data of the detailed address, so that the nearest city input frame element with the coordinate data on the right side of the coordinate data of the detailed address can be determined as the webpage element to be positioned. Further, coordinate data of the positioning keywords in the webpage can be obtained by searching the positioning keywords. And searching the webpage elements positioned near the positioning keywords according to the coordinates of the positioning keywords. Web page elements that are consistent with the relative position of the positioning key and the position locator indication are screened from web page elements that are located near the positioning key. If the coordinate data of the detailed address in the webpage is found, searching all webpage elements positioned near the detailed address according to the coordinate data, wherein the webpage elements comprise a login name, a login name input box, a determination button and the like. From these web page elements, the city input box element located to the right of the coordinates of the detailed address is found from the coordinate data.
According to the webpage element positioning method provided by the invention, the input character string containing the positioning keywords is received, and the webpage elements matched with the positioning keywords can be positioned in a traversing mode. Further, when the position locator is specified, the web page element consistent with the relative position of the positioning keyword and the position locator indication is searched, and the web page element can be accurately positioned. When the webpage elements are positioned, the definition of the elements in the webpage codes is found without looking at the html, js and other codes in the webpage. The method can directly realize the positioning of the webpage elements from various information such as characters, position relations and the like displayed on the webpage, gets rid of the limitation that the positioning can be performed only by reading codes, and is simple and easy to execute.
FIG. 4 is a flow chart illustrating a method of locating a web page element according to another embodiment of the invention. As shown in fig. 4, the positioning method of the web page element specifically includes the following steps:
step S201, an input character string containing a positioning keyword is received.
Step S202, judging whether the character string is provided with a window identifier.
The character string may include a window identifier in addition to the positioning key and the position locator. The window is identified as a window title. When a plurality of webpages exist, for example, clicking a button or a link element in the webpage A, popping up the webpage B, and simultaneously, two webpages exist; or clicking a button or a link element in the webpage B, popping up the webpage C, and simultaneously, storing three webpages; or there may be cases where multiple web pages continue to be popped up. If an element to be positioned is searched, a plurality of webpages are searched due to the existence of the webpages, and more time is spent in searching the webpages; or when at least two web pages have the same web page elements, positioning errors easily occur when the web page elements are positioned. Therefore, in order to find more accurately and quickly, a window identifier, that is, a title of a web page window where a web page element to be positioned is located, can be set in the character string. Through the window identification, the search range of the element to be positioned can be accurately and rapidly limited in a specific webpage window. If the element to be located is in webpage B, the window is identified as the window title of webpage B.
If it is determined that the character string is provided with the window identifier, step S203 is performed. If the character string is judged to have no window identifier, the subsequent operation can continue to judge the character string, judge whether the character string contains the position locator, and if the character string contains the position locator, search the webpage element consistent with the relative position of the positioning keyword and the position locator indication. If the position locator is not included, traversing the webpage elements matched with the positioning keywords in the webpage.
Step S203, traversing the webpage elements matched with the positioning keywords in the window corresponding to the window identification.
If the character string is judged to be provided with the window identification, firstly traversing each window to find the window corresponding to the window identification. After the window is found, the subsequent operation can continue to judge the character string, judge whether the character string contains the position locator, if so, search the web page element consistent with the relative position of the positioning key words and the position locator indication in the window. If the position locator is not included, traversing the webpage elements matched with the positioning keywords in the window. The execution of step S203 may be referred to the descriptions of step S102-step S104, and will not be repeated here.
According to the webpage element positioning method provided by the invention, the plurality of webpage windows are positioned through the window identification, and then the element to be positioned is searched in the positioned windows, so that the time for searching the plurality of windows is reduced. And meanwhile, positioning errors caused by positioning the webpage elements when the same webpage elements exist in a plurality of webpages are avoided.
FIG. 5 illustrates a functional block diagram of a web page element locating apparatus according to one embodiment of the invention. As shown in fig. 5, the positioning device of the web page element includes the following modules:
The receiving module 301 is adapted to receive an input character string containing a positioning keyword.
The web page includes a number of elements including an input box element for input, a button element, an element for providing link skip, a selection box element, text for prompting information, and the like. The login web page shown in fig. 2 displays prompt information characters such as a user name, a password, a user name and the like, corresponding input frame elements and radio frame elements are arranged beside the characters, and the web page also comprises button elements such as login, cancel and the like and a link element which returns to the upper page. The positioning keywords are derived from characters displayed in the webpage and can be characters used for prompting information, such as user names, passwords and the like; text in the link element, such as return to the upper page, is also possible; but also the text displayed by the button element, such as cancellation. Further, the positioning key may be part of the text displayed in the web page, such as a return.
The positioning keywords are set according to the webpage elements to be positioned, and the positioning keywords received by the receiving module 301 are related to the webpage elements to be positioned. If the web page element to be located is the input box of the password, the location key received by the receiving module 301 is the password or the secret. If the web page element to be located is a login button, the location key received by the receiving module 301 is login. If the web page element to be located is a link element, the location key received by the receiving module 301 is returned to the upper page or returned.
The locator determination module 302 is adapted to determine whether the character string contains a location locator.
The character string may include a position locator in addition to the positioning keyword. The position locator is used for indicating the relative position of the positioning keyword and the webpage element to be positioned. As shown in fig. 2, when the element of the web page to be positioned is the input frame of the password, the position locator is the relative position of the password text and the input frame of the password when the positioning keyword received by the receiving module 301 is set as the password, the password input frame is on the right side of the password text, and the position locator is on the right side; when the positioning key received by the receiving module 301 is a user name, the position locator is a relative position of an input box for memorizing characters of the user name and passwords, the password input box is at the upper side for memorizing the characters of the user name, and the position locator is at the upper side. When the webpage element to be positioned is a login button, the positioning keyword received by the receiving module 301 is login, and the login text and the login button are located at the same place, so that a position locator is not required to be set; when the positioning key received by the receiving module 301 is cancel, the login button is on the left side of the cancel text, and the position locator is on the left side.
The locator determination module 302 determines whether the character string contains a location locator, if so, executes the locator search module 304, otherwise, executes the element traversal module 303.
The element traversing module 303 is adapted to traverse the web page elements matching the positioning keywords in the web page if the character string does not contain the position locator.
The element traversal module 303 traverses web page elements in the web page to find web page elements that match the locating keywords. When the element traversing module 303 locates the web page element login button by locating the keyword login, an object of the login web page is generated for the web address of the login web page, and the element traversing module 303 traverses the elements in the web page object to find the web page element matched with the login.
The locator search module 304 is adapted to search for a web page element consistent with the relative location of the location key and the location locator indication if the string contains a location locator.
When a position locator is included in the string, locator lookup module 304 looks up the web page element that is consistent with the relative position of the location key and the position locator indication. The locator search module 304 may find the location of the locating key by searching the locating key, and further, the locator search module 304 searches the web page elements located on the locator side of the location of the locating key. If the element to be located is a user name input box, the locator searching module 304 searches the location of the user name locating keyword, and searches the webpage element located on the right side of the location keyword, so that the user name input box element can be located.
When the number of the web page elements corresponding to the relative positions of the positioning keywords and the position locator indicates that the web page elements are multiple, as shown in fig. 3, the web page element to be positioned is a city input frame, the positioning keywords are detailed addresses, and when the position locator is on the right side, the locator searching module 304 searches the web page elements on the right side of the detailed addresses, and can find the multiple web page elements of the city input frame, the district input frame and the county input frame, and the web page element closest to the position of the positioning keywords is the web page element to be positioned. The coordinate data of a plurality of webpage elements of the city input frame, the district input frame and the county input frame are compared with the coordinate data of the detailed address, so that the nearest city input frame element of the coordinate data on the right side of the coordinate data of the detailed address is determined to be the webpage element to be positioned.
Further, the locator search module 304 further includes the following modules:
The coordinate acquisition module 3041 is adapted to acquire coordinates of the positioning keyword in the web page.
The element searching module 3042 is adapted to search the web page elements located near the positioning keyword according to the coordinates.
The element locating module 3043 is adapted to screen out the web page elements located near the locating key, which are consistent with the relative position of the locating key and the position locator indication.
The coordinate acquisition module 3041 searches for the positioning keyword, and acquires coordinate data of the positioning keyword in the web page. The element search module 3042 searches for web page elements located near the location key according to the coordinates of the location key. The element locating module 3043 screens out web page elements that are consistent with the relative position of the locating key and the position locator indication from among the web page elements that are located near the locating key. If the coordinate acquisition module 3041 finds the coordinate data of the detailed address in the web page, the element search module 3042 searches all the web page elements located near the detailed address according to the coordinate data, and the web page elements include login name, login name input box, determination button and the like. The element locating module 3043 finds the city input box element located on the right side of the coordinates of the detailed address from these web page elements according to the coordinate data.
According to the webpage element positioning device provided by the invention, the input character string containing the positioning keywords is received, and the webpage elements matched with the positioning keywords can be positioned in a traversing mode. Further, when the position locator is specified, the web page element consistent with the relative position of the positioning keyword and the position locator indication is searched, and the web page element can be accurately positioned. When the webpage elements are positioned, the definition of the elements in the webpage codes is found without looking at the html, js and other codes in the webpage. The method can directly realize the positioning of the webpage elements from various information such as characters, position relations and the like displayed on the webpage, gets rid of the limitation that the positioning can be performed only by reading codes, and is simple and easy to execute.
FIG. 6 illustrates a functional block diagram of a web page element locating apparatus according to another embodiment of the present invention. Compared with fig. 5, the difference is that the positioning device of the web page element further comprises:
the window identifier judging module 305 is adapted to judge whether a window identifier is set for the character string.
The character string may include a window identifier in addition to the positioning key and the position locator. The window is identified as a window title. When a plurality of webpages exist, for example, clicking a button or a link element in the webpage A, popping up the webpage B, and simultaneously, two webpages exist; or clicking a button or a link element in the webpage B, popping up the webpage C, and simultaneously, storing three webpages; or there may be cases where multiple web pages continue to be popped up. If an element to be positioned is searched, a plurality of webpages are searched due to the existence of the webpages, and more time is spent in searching the webpages; or when at least two web pages have the same web page elements, positioning errors easily occur when the web page elements are positioned. Therefore, in order to find more accurately and quickly, a window identifier, that is, a title of a web page window where a web page element to be positioned is located, can be set in the character string. Through the window identification, the search range of the element to be positioned can be accurately and rapidly limited in a specific webpage window. If the element to be located is in webpage B, the window is identified as the window title of webpage B.
If the window identifier judging module 305 judges that the window identifier is not set in the character string, the subsequent operation may continue to execute the locator judging module 302 to judge the character string, and if the locator judging module 302 judges that the character string contains the location locator, the locator searching module 304 searches the web page element consistent with the relative location of the locating keyword and the location locator indication. If the locator judgment module 302 judges that the character string does not contain the location locator, the execution element traversing module 303 traverses the web page element matched with the location keyword in the web page.
If the window identifier judging module 305 judges that the character string is provided with the window identifier, the locator judging module 302 continues to execute to judge the character string, and if the locator judging module 302 judges that the character string contains the position locator, the locator searching module 304 is executed to traverse each window to find the window corresponding to the window identifier. After finding the window, the web page elements in the window, which are consistent with the relative positions of the positioning keywords and the position locator indications, are found. If the locator judgment module 302 judges that the character string does not contain the location locator, the execution element traversing module 303 traverses each window to find the window corresponding to the window identifier. After finding the window, traversing the webpage elements matched with the positioning keywords in the window.
According to the webpage element positioning device provided by the invention, the plurality of webpage windows are positioned through the window identification, and then the element to be positioned is searched in the positioned windows, so that the time for searching the plurality of windows is reduced. And meanwhile, positioning errors caused by positioning the webpage elements when the same webpage elements exist in a plurality of webpages are avoided.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood 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 construed as reflecting the intention that: i.e., the claimed invention 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 apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. 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. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units 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 but not others included in other embodiments, 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 can be used in any combination.
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 some or all of the functions of some or all of the components in a positioning device for a web page element according to an embodiment of the invention may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). The present invention can also be implemented as an apparatus or device program (e.g., a computer program and a computer program product) for performing a portion or all of the methods described herein. Such a program embodying the present invention may be stored on a computer readable medium, or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided 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 use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.

Claims (10)

1. A method for locating a web page element, comprising:
Receiving an input character string containing positioning keywords, wherein the positioning keywords are derived from characters displayed in a webpage;
Judging whether the character string contains a position locator or not, wherein the position locator is used for indicating the relative position of the positioning keyword and the webpage element to be positioned;
If the character string does not contain the position locator, traversing the webpage elements matched with the positioning keywords in the webpage;
If the character string contains the position locator, searching a webpage element consistent with the relative position of the positioning keyword and the position locator indication;
The locating the web page element consistent with the relative location of the positioning key and the location locator indication further comprises:
acquiring coordinates of the positioning keywords in the webpage;
Searching the webpage elements positioned near the positioning keywords according to the coordinates;
And screening out the webpage elements positioned near the positioning key words, wherein the webpage elements are consistent with the relative positions of the positioning key words and the position locator indications.
2. The method of claim 1, wherein the location key is part of a text displayed in a web page.
3. The method of claim 1 or 2, wherein the locating web page elements that are consistent with the relative location of the location key and the location locator indication further comprises:
And searching the webpage elements which are consistent with the relative positions of the positioning keywords and the position locator indications and are closest to the positions of the positioning keywords.
4. The method of any of claims 1-2, wherein after the receiving the entered string containing the locating key, the method further comprises:
judging whether the character string is provided with a window identifier or not;
the traversing the web page elements matched with the positioning keywords in the web page is further as follows:
If the character string is judged to be provided with a window identifier, traversing webpage elements matched with the positioning keywords in a window corresponding to the window identifier;
the searching the web page elements consistent with the relative positions of the positioning keywords and the position locator indication is further as follows:
If the character string is judged to be provided with the window identifier, searching the webpage element, corresponding to the window identifier, in the window, wherein the relative position of the positioning keyword and the position locator indication are consistent.
5. The method of claim 4, wherein the window identifier is a window title.
6. A locating device for web page elements, comprising:
the receiving module is suitable for receiving an input character string containing positioning keywords, wherein the positioning keywords are derived from characters displayed in a webpage;
The locator judging module is suitable for judging whether the character string contains a location locator or not, wherein the location locator is used for indicating the relative position of the locating keyword and the webpage element to be located;
The element traversing module is suitable for traversing the webpage elements matched with the positioning keywords in the webpage if the character string does not contain the position locator;
The locator searching module is suitable for searching the webpage element consistent with the relative position of the positioning keyword and the position locator indication if the character string contains the position locator;
the locator search module further comprises:
the coordinate acquisition module is suitable for acquiring the coordinates of the positioning keywords in the webpage;
the element searching module is suitable for searching the webpage elements positioned near the positioning keywords according to the coordinates;
and the element positioning module is suitable for screening out the webpage elements which are consistent with the relative positions of the positioning keywords and the position locator indications from the webpage elements which are positioned nearby the positioning keywords.
7. The apparatus of claim 6, wherein the positioning keyword is part of a text displayed in a web page.
8. The apparatus of claim 6, wherein the locator search module is further adapted to: and searching the webpage elements which are consistent with the relative positions of the positioning keywords and the position locator indications and are closest to the positions of the positioning keywords.
9. The apparatus according to any one of claims 6-8, wherein the apparatus further comprises:
the window identification judging module is suitable for judging whether the character string is provided with a window identification or not;
the element traversal module is further adapted to: if the character string is judged to be provided with a window identifier, traversing webpage elements matched with the positioning keywords in a window corresponding to the window identifier;
The locator search module is further adapted to: if the character string is judged to be provided with the window identifier, searching the webpage element, corresponding to the window identifier, in the window, wherein the relative position of the positioning keyword and the position locator indication are consistent.
10. The apparatus of claim 9, wherein the window identifier is a window title.
CN201610520639.1A 2016-07-04 2016-07-04 Webpage element positioning method and device Active CN107577592B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610520639.1A CN107577592B (en) 2016-07-04 2016-07-04 Webpage element positioning method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610520639.1A CN107577592B (en) 2016-07-04 2016-07-04 Webpage element positioning method and device

Publications (2)

Publication Number Publication Date
CN107577592A CN107577592A (en) 2018-01-12
CN107577592B true CN107577592B (en) 2024-04-19

Family

ID=61049392

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610520639.1A Active CN107577592B (en) 2016-07-04 2016-07-04 Webpage element positioning method and device

Country Status (1)

Country Link
CN (1) CN107577592B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101419620A (en) * 2008-12-03 2009-04-29 腾讯科技(深圳)有限公司 Method for shielding web page element and apparatus thereof
CN102902723A (en) * 2012-09-06 2013-01-30 北京北森测评技术有限公司 Method and device for analyzing network data
CN103631875A (en) * 2013-11-08 2014-03-12 北京奇虎科技有限公司 Method for carrying out network search on browser side and browser
CN104965912A (en) * 2015-07-06 2015-10-07 安一恒通(北京)科技有限公司 Information acquisition method and apparatus
CN104980404A (en) * 2014-04-10 2015-10-14 腾讯科技(深圳)有限公司 Method and system for protecting account information security

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5238437B2 (en) * 2008-09-30 2013-07-17 株式会社東芝 Web browsing purpose classification device, web browsing purpose classification method, and web browsing purpose classification program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101419620A (en) * 2008-12-03 2009-04-29 腾讯科技(深圳)有限公司 Method for shielding web page element and apparatus thereof
CN102902723A (en) * 2012-09-06 2013-01-30 北京北森测评技术有限公司 Method and device for analyzing network data
CN103631875A (en) * 2013-11-08 2014-03-12 北京奇虎科技有限公司 Method for carrying out network search on browser side and browser
CN104980404A (en) * 2014-04-10 2015-10-14 腾讯科技(深圳)有限公司 Method and system for protecting account information security
CN104965912A (en) * 2015-07-06 2015-10-07 安一恒通(北京)科技有限公司 Information acquisition method and apparatus

Also Published As

Publication number Publication date
CN107577592A (en) 2018-01-12

Similar Documents

Publication Publication Date Title
CN104252410B (en) The method and apparatus that a kind of control in the page is tested
CN103632100B (en) A kind of website vulnerability detection method and device
CN105868096B (en) For showing the method, device and equipment of web page test result in a browser
CN107729235B (en) Method, apparatus, device and computer readable medium for locating code defect producer
CN104980404B (en) Method and system for protecting account information security
CN102880613A (en) Identification method of porno pictures and equipment thereof
CN110175609A (en) Interface element detection method, device and equipment
CN105183908A (en) Point of interest (POI) data classifying method and device
CN103544257B (en) Method and device for webpage quality detection
CN105187439A (en) Phishing website detection method and device
JP2017091208A (en) Document inspection support device, document inspection support system, and program
US20080306752A1 (en) Method and system for automatic testing in a business scenario environment
CN107577592B (en) Webpage element positioning method and device
JP4788841B2 (en) GUI evaluation system, GUI evaluation method, and GUI evaluation program
CN104503679A (en) Searching method and searching device based on terminal interface touch operation
CN105243134B (en) A kind of method and apparatus handling browser of being held as a hostage
CN104392009B (en) The method and apparatus obtaining mobile site chained address
KR101479834B1 (en) Method of exposing an advertisement based on user behavior and device thereof
US20100138412A1 (en) Method for showing objects of geographic information by seriation of distance
CN106446687B (en) Malicious sample detection method and device
CN109815083A (en) A kind of monitoring method of application crashes, device, electronic equipment and medium
US20110119296A1 (en) Method and apparatus for displaying data
KR20190020363A (en) Method and apparatus for analyzing program by associating dynamic analysis with static analysis
CN109002427A (en) The method, apparatus and electronic equipment of refresh function parameter in electrical form
CN112395519A (en) Method and device for generating interest points in road information

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
CB02 Change of applicant information

Address after: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Applicant after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Applicant after: Beijing Qizhi Business Consulting Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Applicant before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Applicant before: Qizhi software (Beijing) Co.,Ltd.

CB02 Change of applicant information
TA01 Transfer of patent application right

Effective date of registration: 20240108

Address after: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Applicant after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Applicant before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Applicant before: Beijing Qizhi Business Consulting Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant