Embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although the disclosure is shown in accompanying drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
Limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
Completely it is communicated to those skilled in the art.
, it is necessary to test each element in webpage when webpage is tested, such as input frame element, it is necessary to test correctly aobvious
Show word, length limitation etc. is carried out to display word;Function is chosen or cancelled to multiselect frame or radio box element, it is necessary to test;Chain
Element is connect, it is necessary to test link clicks function;Button element is, it is necessary to click function of testing button etc..Different elements are all
Need to test different function realizations.
Fig. 1 shows the flow chart of the localization method of web page element according to an embodiment of the invention.As shown in figure 1,
The localization method of web page element specifically comprises the following steps:
Step S101, receive the character string for including positioning keyword of input.
Webpage includes many elements, has the input frame element for input, button element, provides the member that link redirects
Element, also choice box element, word for prompt message etc..Log-on webpage as shown in Figure 2, show in webpage such as with
Name in an account book, password, remember the prompt message word such as user name, there is its corresponding input frame element, radio box member by these words
Element, further comprises in webpage such as log in, cancel button element, linking element returns to upper page.Positioning keyword derives from webpage
The word of middle display, can be the word for prompt message, such as user name, password;It can also be the text in linking element
Word, such as return to upper page;The word that button element is shown is can also be, is such as cancelled.Further, it can be in webpage to position keyword
A part for the word of display, such as return.
Determine to position keyword according to web page element to be positioned, position keyword and web page element phase to be positioned
Close.When such as web page element to be positioned is the input frame of password, positioning keyword can be arranged to password or close.It is such as to be positioned
Web page element when being login button, positioning keyword can be arranged to log in.If web page element to be positioned is link member
When plain, positioning keyword can be arranged to return to upper page or return.
Step S102, judge whether include position finger URL in character string.
In character string in addition to comprising positioning keyword, position finger URL can also be included.Position finger URL is used to indicate to determine
The relative position of position keyword and web page element to be positioned.Log-on webpage as shown in Figure 2, when web page element to be positioned is password
Input frame when, for positioning keyword when being arranged to password, position finger URL is the relative position of the input frame of cipher text and password
Put, for Password Input frame on the right side of cipher text, position finger URL is right side;When positioning keyword is arranged to remember user name,
Position finger URL is the relative position for the input frame for remembeing user name word and password, and Password Input frame is remembeing user name word
Upside, position finger URL is upside.When web page element to be positioned is login button, when positioning keyword is arranged to log in,
Word and login button are logged in same place, therefore need not set location finger URL again;When positioning keyword is arranged to cancel,
Login button is cancelling the left side of word, and position finger URL is left side.
Judge whether include position finger URL in character string, if comprising, step S104 is performed, otherwise, execution step S103.
Step S103, travel through the web page element with positioning keyword match in webpage.
The web page element in webpage is traveled through, searches the web page element to match with positioning keyword.It is such as crucial by positioning
When word login carrys out locating web-pages element login button, the object of log-on webpage is generated for the network address of log-on webpage, in webpage pair
As the element in middle traversal webpage, search with logging in the web page element matched.
Step S104, search the web page element consistent with the relative position and the instruction of position finger URL for positioning keyword.
Required to look up when containing position finger URL in character string, during lookup and the relative position of positioning keyword and position
Put finger URL and indicate consistent web page element.The position of positioning keyword can be found by Search and Orientation keyword, enters one
Step, search the web page element of the side indicated by the position finger URL positioned at positioning keyword.If element to be positioned is user name
During input frame, the position of keyword is positioned by finding user name, then search the web page element on the right side of it, it is possible to fixed
Position user name input frame element.
When the web page element consistent with the relative position and the instruction of position finger URL for positioning keyword when lookup has multiple,
As shown in figure 3, web page element to be positioned is city's input frame, Search and Orientation keyword is better address, and position finger URL is right side
When, the web page element on the right side of better address is searched, city's input frame, area's input frame, the multiple webpages of county's input frame can be found
Element is, it is necessary to which it is web page element to be positioned to take the web page element nearest wherein with positioning the positional distance of keyword.Pass through
The coordinate data of city's input frame, area's input frame, the coordinate data of the multiple web page elements of county's input frame and better address is compared
Compared with, and then can determine that coordinate data city's input frame element nearest on the right side of the coordinate data of better address is net to be positioned
Page element.Further, coordinate data of the positioning keyword in webpage can also be obtained by Search and Orientation keyword.According to
The coordinate for positioning keyword is searched positioned at the web page element positioned near keyword.From the webpage member near positioning keyword
The web page element consistent with the relative position and the instruction of position finger URL for positioning keyword is filtered out in element.Such as find in detail
Coordinate data of the address in webpage, all web page elements near better address are searched according to coordinate data, there is login
The web page element such as name, login name input frame, confirming button.Found from these web page elements according to coordinate data positioned at better address
Coordinate on the right side of city's input frame element.
According to the localization method of web page element provided by the invention, receive input includes the character string for positioning keyword,
The web page element with positioning keyword match can be positioned by way of traversal.Further when further specify position finger URL
When, the web page element consistent with the relative position and the instruction of position finger URL for positioning keyword is searched, can accurately be positioned
Web page element.So that when positioning web page element, without codes such as html, the js checked in webpage, go to find web page code
In definition to element.The multi-aspect informations such as word that can be directly from web displaying, position relationship, are realized to web page element
Positioning, the limitation that code could be positioned must be read by breaking away from, easy easily to perform.
Fig. 4 shows the flow chart of the localization method of web page element in accordance with another embodiment of the present invention.Such as Fig. 4 institutes
Show, the localization method of web page element specifically comprises the following steps:
Step S201, receive the character string for including positioning keyword of input.
Step S202, judge whether that character string is provided with window ID.
In character string in addition to comprising positioning keyword, position finger URL, window ID can also be included.Window ID is
Window title.When multiple webpages be present, certain button or linking element are such as clicked in webpage A, webpage B is ejected, existing simultaneously
Two webpages;Or certain button or linking element in webpage clicking B, ejection webpage C, while three webpages be present again;Or may be used also
There is a situation where to continue to eject multiple webpages.If search an element to be positioned, due to there is the presence of multiple webpages, search
When multiple webpages are searched, more time can be spent;Or have at least two webpages when identical web page element be present, it is right
When web page element is positioned, Wrong localization easily occurs.Therefore, can be in character string for the lookup of more accurate quick
Window ID is set, that is, the title of the web page windows where web page element to be positioned is set., can be accurately fast by window ID
The seeking scope by element to be positioned of speed is limited in specific web page windows.Such as element to be positioned is in webpage B, window mark
Know for webpage B window title.
If judging, character string is provided with window ID, performs step S203.If judge to be not provided with window in character string
Mark, subsequent operation can continue to judge character string judge whether include position finger URL in character string, if including position
Finger URL is put, searches the web page element consistent with the relative position and the instruction of position finger URL for positioning keyword.If do not include
Position finger URL, travel through the web page element with positioning keyword match in webpage.
Step S203, travel through the web page element with positioning keyword match in window corresponding with window ID.
If judging, character string is provided with window ID, travels through each window first, finds window corresponding with window ID.
After finding window, subsequent operation can continue to judge character string, judge whether include position finger URL in character string, if
Comprising position finger URL, the webpage consistent with the relative position and the instruction of position finger URL for positioning keyword is searched in the window
Element.If not including position finger URL, in cycling among windows with position keyword match web page element.Step S203 execution
Journey can be found in above-mentioned steps S102- steps S104 description, will not be repeated here.
According to the localization method of web page element provided by the invention, first multiple web page windows are determined by window ID
Position, then element to be positioned is searched in the window of positioning, reduce and search the time that multiple windows are spent.Simultaneously avoid by
When identical web page element in multiple webpages be present, Wrong localization occurred is positioned to web page element.
Fig. 5 shows the functional block diagram of the positioner of web page element according to an embodiment of the invention.Such as Fig. 5 institutes
Show, the positioner of web page element includes following module:
Receiving module 301, suitable for receiving the character string for including positioning keyword of input.
Webpage includes many elements, has the input frame element for input, button element, provides the member that link redirects
Element, also choice box element, word for prompt message etc..Log-on webpage as shown in Figure 2, show in webpage such as with
Name in an account book, password, remember the prompt message word such as user name, there is its corresponding input frame element, radio box member by these words
Element, further comprises in webpage such as log in, cancel button element, linking element returns to upper page.Positioning keyword derives from webpage
The word of middle display, can be the word for prompt message, such as user name, password;It can also be the text in linking element
Word, such as return to upper page;The word that button element is shown is can also be, is such as cancelled.Further, it can be in webpage to position keyword
A part for the word of display, such as return.
Positioning keyword is set according to web page element to be positioned, the positioning keyword that receiving module 301 receives with it is undetermined
The web page element of position is related.When such as web page element to be positioned is the input frame of password, the positioning that receiving module 301 receives is crucial
Word is password or close.When such as web page element to be positioned is login button, the positioning keyword that receiving module 301 receives is to step on
Record.When such as web page element to be positioned is linking element, the positioning keyword that receiving module 301 receives for the upper page of return or returns
Return.
Finger URL judge module 302, suitable for judging whether include position finger URL in character string.
In character string in addition to comprising positioning keyword, position finger URL can also be included.Position finger URL is used to indicate to determine
The relative position of position keyword and web page element to be positioned.Log-on webpage as shown in Figure 2, when web page element to be positioned is password
Input frame when, for the positioning keyword that receiving module 301 receives when being arranged to password, position finger URL is cipher text and password
Input frame relative position, for Password Input frame on the right side of cipher text, position finger URL is right side;Receiving module 301 connects
The positioning keyword of receipts is when remembeing user name, position finger URL is the relative position for the input frame for remembeing user name word and password
Put, Password Input frame is remembeing the upside of user name word, and position finger URL is upside.When web page element to be positioned is pressed for login
During button, the positioning keyword that receiving module 301 receives is when logging in, and logs in word with login button in same place, therefore be not required to
Will set location finger URL again;When the positioning keyword that receiving module 301 receives is cancels, login button is cancelling a left side for word
Side, position finger URL are left side.
Finger URL judge module 302 judges whether include position finger URL in character string, if comprising execution finger URL is searched
Module 304, otherwise, perform element spider module 303.
Element spider module 303, if suitable for not including position finger URL in character string, travel through crucial with positioning in webpage
The web page element of word matching.
Element spider module 303 travels through the web page element in webpage, searches the web page element to match with positioning keyword.
When being logged in such as element spider module 303 by positioning keyword come locating web-pages element login button, for the net of log-on webpage
Location generates the object of log-on webpage, and element spider module 303 travels through the element in webpage in web object, searches and login
The web page element matched somebody with somebody.
Finger URL searching modul 304, if suitable for including position finger URL in character string, search the phase with positioning keyword
Consistent web page element is indicated to position and position finger URL.
When containing position finger URL in character string, finger URL searching modul 304 is searched relative with positioning keyword
Position and position finger URL indicate consistent web page element.Finger URL searching modul 304 can be with by Search and Orientation keyword
The position of positioning keyword is found, further, finger URL searching modul 304 is searched positioned at the position finger URL side of positioning keyword
Web page element.When such as element to be positioned is user name input frame, it is crucial that finger URL searching modul 304 finds user name positioning
The position of word, then search the web page element on the right side of it, it is possible to position user name input frame element.
When the web page element consistent when the relative position and the instruction of position finger URL with positioning keyword has multiple, such as scheme
Shown in 3, web page element to be positioned is city's input frame, and positioning keyword is better address, when position finger URL is right side, finger URL
Searching modul 304 searches the web page element on the right side of better address, can find city's input frame, area's input frame, county's input frame
Multiple web page elements, it is web page element to be positioned to take the web page element nearest wherein with positioning the positional distance of keyword.I.e.
By the way that the coordinate data of city's input frame, area's input frame, the coordinate data of the multiple web page elements of county's input frame and better address is entered
Row compares, and then determines that coordinate data city's input frame element nearest on the right side of the coordinate data of better address is net to be positioned
Page element.
Further, finger URL searching modul 304 also includes following module:
Coordinate obtaining module 3041, suitable for obtaining coordinate of the positioning keyword in webpage.
Element searching modul 3042, suitable for searching the web page element near positioning keyword according to coordinate.
Element locating module 3043, it is crucial with positioning suitable for being filtered out from the web page element near positioning keyword
The relative position and position finger URL of word indicate consistent web page element.
The Search and Orientation keyword of coordinate obtaining module 3041, obtain coordinate data of the positioning keyword in webpage.Element
Searching modul 3042 searches the web page element near positioning keyword according to the coordinate of positioning keyword.Element locating module
3043 filter out the relative position and position finger URL with positioning keyword from the web page element near positioning keyword
Indicate consistent web page element.As coordinate obtaining module 3041 finds coordinate data of the better address in webpage, element
Searching modul 3042 searches all web page elements near better address according to coordinate data, has login name, login name defeated
Enter the web page elements such as frame, confirming button.Element locating module 3043 is found positioned at detailed from these web page elements according to coordinate data
City's input frame element on the right side of the coordinate of thin address.
According to the positioner of web page element provided by the invention, receive input includes the character string for positioning keyword,
The web page element with positioning keyword match can be positioned by way of traversal.Further when further specify position finger URL
When, the web page element consistent with the relative position and the instruction of position finger URL for positioning keyword is searched, can accurately be positioned
Web page element.So that when positioning web page element, without codes such as html, the js checked in webpage, go to find web page code
In definition to element.The multi-aspect informations such as word that can be directly from web displaying, position relationship, are realized to web page element
Positioning, the limitation that code could be positioned must be read by breaking away from, easy easily to perform.
Fig. 6 shows the functional block diagram of the positioner of web page element in accordance with another embodiment of the present invention.With Fig. 5 phases
Than difference is, the positioner of web page element also includes:
Window ID judge module 305, suitable for determining whether that character string is provided with window ID.
In character string in addition to comprising positioning keyword, position finger URL, window ID can also be included.Window ID is
Window title.When multiple webpages be present, certain button or linking element are such as clicked in webpage A, webpage B is ejected, existing simultaneously
Two webpages;Or certain button or linking element in webpage clicking B, ejection webpage C, while three webpages be present again;Or may be used also
There is a situation where to continue to eject multiple webpages.If search an element to be positioned, due to there is the presence of multiple webpages, search
When multiple webpages are searched, more time can be spent;Or have at least two webpages when identical web page element be present, it is right
When web page element is positioned, Wrong localization easily occurs.Therefore, can be in character string for the lookup of more accurate quick
Window ID is set, that is, the title of the web page windows where web page element to be positioned is set., can be accurately fast by window ID
The seeking scope by element to be positioned of speed is limited in specific web page windows.Such as element to be positioned is in webpage B, window mark
Know for webpage B window title.
If window ID judge module 305 judges to be not provided with window ID in character string, subsequent operation can continue to hold
Row finger URL judge module 302 is judged character string, if finger URL judge module 302 judges comprising position to determine in character string
Position symbol, it is consistent with the relative position and the instruction of position finger URL for positioning keyword to perform the lookup of finger URL searching modul 304
Web page element.If finger URL judge module 302 judges not including position finger URL in character string, element spider module 303 is performed
Travel through the web page element with positioning keyword match in webpage.
If window ID judge module 305 judges that character string is provided with window ID, finger URL judge module is continued executing with
302 pairs of character strings judge, if finger URL judge module 302 judges to include position finger URL in character string, perform finger URL
Searching modul 304 travels through each window, finds window corresponding with window ID.After finding window, search in the window with positioning
The relative position and position finger URL of keyword indicate consistent web page element.If finger URL judge module 302 judges character
Do not include position finger URL in string, perform element spider module 303 and travel through each window, find window corresponding with window ID.
After finding window, the web page element with positioning keyword match in the window is traveled through.
According to the positioner of web page element provided by the invention, first multiple web page windows are determined by window ID
Position, then element to be positioned is searched in the window of positioning, reduce and search the time that multiple windows are spent.Simultaneously avoid by
When identical web page element in multiple webpages be present, Wrong localization occurred is positioned to web page element.
Algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment provided herein.
Various general-purpose systems can also be used together with teaching based on this.As described above, required by constructing this kind of system
Structure be obvious.In addition, the present invention is not also directed to any certain programmed language.It should be understood that it can utilize various
Programming language realizes the content of invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In the specification that this place provides, numerous specific details are set forth.It is to be appreciated, however, that the implementation of the present invention
Example can be put into practice in the case of these no details.In some instances, known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and help to understand one or more of each inventive aspect,
Above in the description to the exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:I.e. required guarantor
The application claims of shield features more more than the feature being expressly recited in each claim.It is more precisely, such as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following embodiment are expressly incorporated in the embodiment, wherein each claim is in itself
Separate embodiments all as the present invention.
Those skilled in the art, which are appreciated that, to be carried out adaptively to the module in the equipment in embodiment
Change and they are arranged in one or more equipment different from the embodiment.Can be the module or list in embodiment
Member or component be combined into a module or unit or component, and can be divided into addition multiple submodule or subelement or
Sub-component.In addition at least some in such feature and/or process or unit exclude each other, it can use any
Combination is disclosed to all features disclosed in this specification (including adjoint claim, summary and accompanying drawing) and so to appoint
Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification (including adjoint power
Profit requires, summary and accompanying drawing) disclosed in each feature can be by providing the alternative features of identical, equivalent or similar purpose come generation
Replace.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments
In included some features rather than further feature, but the combination of the feature of different embodiments means in of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed
One of meaning mode can use in any combination.
The all parts embodiment of the present invention can be realized with hardware, or to be run on one or more processor
Software module realize, or realized with combinations thereof.It will be understood by those of skill in the art that it can use in practice
Microprocessor or digital signal processor (DSP) are realized in the positioner of web page element according to embodiments of the present invention
The some or all functions of some or all parts.The present invention is also implemented as being used to perform method as described herein
Some or all equipment or program of device (for example, computer program and computer program product).Such reality
The program of the existing present invention can store on a computer-readable medium, or can have the form of one or more signal.
Such signal can be downloaded from internet website and obtained, and either be provided or in the form of any other on carrier signal
There is provided.
It should be noted that the present invention will be described rather than limits the invention for above-described embodiment, and ability
Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims,
Any reference symbol between bracket should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not
Element or step listed in the claims.Word "a" or "an" before element does not exclude the presence of multiple such
Element.The present invention can be by means of including the hardware of some different elements and being come by means of properly programmed computer real
It is existing.In if the unit claim of equipment for drying is listed, several in these devices can be by same hardware branch
To embody.The use of word first, second, and third does not indicate that any order.These words can be explained and run after fame
Claim.
The invention also discloses:
A1, a kind of localization method of web page element, it includes:
The character string for including positioning keyword of input is received, the positioning keyword derives from the text shown in webpage
Word;
Judge position finger URL whether is included in the character string, the position finger URL is used to indicate that the positioning is crucial
The relative position of word and the web page element to be positioned;
If not including the position finger URL in the character string, travel through in the webpage and position keyword with described
The web page element matched somebody with somebody;
If including the position finger URL in the character string, search and the relative position of the positioning keyword and institute
Rheme puts finger URL and indicates consistent web page element.
A2, the method according to A1, wherein, the positioning keyword is a part for the word shown in webpage.
A3, the method according to A1 or A2, wherein, relative position and the position of the lookup with positioning keyword
Finger URL indicates that consistent web page element further comprises:
Search consistent with the relative position for positioning keyword and position finger URL instruction and with positioning keyword
The nearest web page element of positional distance.
A4, the method according to any one of A1-A3, wherein, relative position and institute of the lookup with positioning keyword
Rheme puts finger URL and indicates that consistent web page element further comprises:
Obtain coordinate of the positioning keyword in the webpage;
Web page element near the positioning keyword is searched according to the coordinate;
Filtered out from the web page element near the positioning keyword and the relative position of positioning keyword and institute
Rheme puts finger URL and indicates consistent web page element.
A5, the method according to any one of A1-A4, wherein, in the word for including positioning keyword for receiving input
After symbol string, methods described also includes:Judge whether that the character string is provided with window ID;
It is further with the web page element for positioning keyword match in the traversal webpage:If judge described
Character string is provided with window ID, then travels through the net with the positioning keyword match in window corresponding with the window ID
Page element;
The lookup web page element consistent with the relative position and position finger URL instruction that position keyword enters
One step is:If judging, the character string is provided with window ID, searches in window corresponding with the window ID with determining
The relative position of position keyword and the position finger URL indicate consistent web page element.
A6, the method according to A5, wherein, the window ID is window title.
B7, a kind of positioner of web page element, it includes:
Receiving module, suitable for receiving the character string for including positioning keyword of input, the positioning keyword derives from net
The word shown in page;
Finger URL judge module, suitable for judging whether include position finger URL, the position finger URL in the character string
For indicating the relative position of the positioning keyword and the web page element to be positioned;
Element spider module, if suitable for not including the position finger URL in the character string, travel through in the webpage
With the web page element of the positioning keyword match;
Finger URL searching modul, if suitable for including the position finger URL in the character string, search and the positioning
The relative position of keyword and the position finger URL indicate consistent web page element.
B8, the device according to B7, wherein, the positioning keyword is a part for the word shown in webpage.
B9, the device according to B7 or B8, wherein, the finger URL searching modul is further adapted for:Search and position
The relative position of keyword and the position finger URL indicate consistent and nearest with positioning the positional distance of keyword webpage
Element.
B10, the device according to any one of B7-B9, wherein, the finger URL searching modul also includes:
Coordinate obtaining module, suitable for obtaining coordinate of the positioning keyword in the webpage;
Element searching modul, suitable for searching the web page element near the positioning keyword according to the coordinate;
Element locating module, it is crucial with positioning suitable for being filtered out from the web page element near the positioning keyword
The relative position of word and the position finger URL indicate consistent web page element.
B11, the device according to any one of B7-B10, wherein, device also includes:
Window ID judge module, suitable for judging whether that the character string is provided with window ID;
The element spider module is further adapted for:If judging, the character string is provided with window ID, traversal with
In window corresponding to the window ID with it is described positioning keyword match web page element;
The finger URL searching modul is further adapted for:If judging, the character string is provided with window ID, searches
With the window ID corresponding in window it is consistent with the relative position and position finger URL instruction that position keyword
Web page element.
B12, the device according to B11, wherein, the window ID is window title.