CN108959062A - Web page element acquisition methods and device - Google Patents
Web page element acquisition methods and device Download PDFInfo
- Publication number
- CN108959062A CN108959062A CN201710363817.9A CN201710363817A CN108959062A CN 108959062 A CN108959062 A CN 108959062A CN 201710363817 A CN201710363817 A CN 201710363817A CN 108959062 A CN108959062 A CN 108959062A
- Authority
- CN
- China
- Prior art keywords
- agency
- target webpage
- subprocess
- plug
- host process
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/544—Buffers; Shared memory; Pipes
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a kind of web page element acquisition methods and devices, belong to automatic test field.This method includes that host process agency receives the acquisition order that test application program is sent, and is ordered according to obtaining, and target webpage element is obtained from subprocess agency by communication channel, the target webpage element that host process agency will acquire is back to test application program.Since host process agency is the process agent in the host process for be arranged in tested application program, subprocess agency is the process agent being arranged in the subprocess of tested application program, the present invention to be in communication with each other between process by establishing host process agency and subprocess communication between agents channel, i.e. host process can act on behalf of the target webpage element got in subprocess from subprocess agency by host process, to which test application program can receive the target webpage element that host process agency sends, and then realize automatic test.
Description
Technical field
The present embodiments relate to automatic test field, in particular to a kind of web page element acquisition methods and device.
Background technique
The task of webpage (World Wide Web, Web) automatic test is usually to obtain web page element (English: Web
Element it), and by the Web element is packaged into web page element object, then simulates manual testing's step to the web page element object
It is operated.
Currently, android terminal (i.e. with the terminal of Android operation system) supports the mode of Web automatic test generally to adopt
With Instrumentation test frame injection mode, operated in together with test application program and tested application program below
It is illustrated in one terminal.As shown in Figure 1, test application program 100 obtains the target webpage element of tested application program 110
112 acquisition methods are as follows: test application program 100 is by the javascript (referred to as: js) in RobotiumWeb.js file 102
After script is injected into the host process 114 of tested application program 110, it is tested application program 110 and executes the js script from host process 114
Middle acquisition target webpage view (English: Target WebView) 116, then target network is extracted from the target webpage view 116
Page element 112, and the target webpage element 112 extracted is sent to test application program 100, so that test application program
100 by being parsed and being packaged into target webpage element object 104 to getting the target webpage element 112.
In above-mentioned Web automatic test, test application program 100 can only test the master of tested application program 110 into
Journey 114.As shown in Fig. 2, if tested application program 110 will be related with execution js script and acquisition target webpage view 116
Logically independent is Web subprocess 118, the Web subprocess 118 and host process not between shared resource i.e. two process mutually solely
It is vertical.Since target webpage view 116 being not present in host process 114, host process 114 can not also obtain the target in subprocess 118
Webpage view 116, therefore after RobotiumWeb.js script 102 is injected into host process 114 by test application program 100, it can not
Target webpage element is obtained from the host process 114 of tested application program 110, and automatic test is caused to be unable to complete.
Summary of the invention
In order to solve to be tested in the related technology application program by the related logic of Web page be put into subprocess realize after, mesh
The problem of preceding test frame can not be supported, the embodiment of the invention provides a kind of web page element acquisition methods and devices.It is described
Technical solution is as follows:
In a first aspect, providing a kind of web page element acquisition methods, which comprises
Host process agency receives the acquisition order that test application program is sent, and the host process agency is that setting is answered tested
With the process agent in the host process of program, the acquisition order is used to indicate the tested application program and obtains target Web page
The target webpage element in face;
The host process agency orders according to the acquisition, obtains the target from subprocess agency by communication channel
Web page element, the subprocess agency is the process agent being arranged in the subprocess of the tested application program, the communication
Channel is that the host process agency established according to interprocess communication IPC mechanism and the subprocess communication between agents are logical
Road;
The target webpage element that the host process agency will acquire is back to the test application program.
Second aspect, provides a kind of web page element acquisition device, and described device includes:
Receiving module acts on behalf of the acquisition order for receiving test application program and sending, the host process agency for host process
It is the process agent being arranged in the host process of tested application program, the acquisition order is used to indicate the tested application program
Obtain the target webpage element of destination Web page;
Module is obtained, is ordered for host process agency according to the acquisition, is acted on behalf of by communication channel from subprocess
Middle to obtain the target webpage element, the subprocess agency is the process being arranged in the subprocess of the tested application program
Agency, the communication channel are that the host process agency established according to interprocess communication IPC mechanism acts on behalf of with the subprocess
Between communication channel;
Module is returned, the test is back to for the target webpage element that will acquire of host process agency and answers
Use program.
The third aspect provides a kind of terminal, and the terminal includes processor and memory, is stored in the memory
At least one instruction, described instruction are loaded by the processor and are executed to realize the webpage as described in claim 1 to 7 is any
Element acquisition methods.
Fourth aspect provides a kind of computer readable storage medium, at least one finger is stored in the storage medium
It enables, described instruction is loaded by processor and executed to realize the web page element acquisition methods as described in claim 1 to 7 is any.
Technical solution provided in an embodiment of the present invention has the benefit that
Due to being provided with a host process agency in host process, a sub- process agent, this implementation are provided in subprocess
Example by host process agency receive test application program send acquisition order, according to obtain order pass through communication channel from son into
Target webpage element is obtained in Cheng Daili, the target webpage element that will acquire is back to test application program;So that host process
And subprocess is able to carry out the communication between process by respective process agent, host process can be acted on behalf of by host process from son into
The target webpage element in subprocess is got in Cheng Daili, is sent so that test application program can receive host process agency
Target webpage element so that test application program tested can answer this according to the target webpage element object after encapsulation
Automatic test is carried out with program.
Detailed description of the invention
Fig. 1 is a kind of structural schematic diagram of implementation environment involved in web page element acquisition methods in the related technology;
Fig. 2 is the structural schematic diagram of implementation environment involved in another web page element acquisition methods in the related technology;
Fig. 3 is the structural schematic diagram of implementation environment involved in web page element acquisition methods provided in an embodiment of the present invention;
Fig. 4 is the flow chart of web page element acquisition methods provided by one embodiment of the present invention;
Fig. 5 is the flow chart for the web page element acquisition methods that another embodiment of the present invention provides;
Fig. 6 is the schematic illustration of web page element acquisition methods provided in an embodiment of the present invention;
Fig. 7 is the structure chart of web page element acquisition device provided by one embodiment of the present invention;
Fig. 8 is the structure chart for the web page element acquisition device that another embodiment of the present invention provides;
Fig. 9 is the structural schematic diagram of terminal provided by one embodiment of the present invention.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention
Formula is described in further detail.
Referring to FIG. 3, it illustrates the knots of terminal involved in web page element acquisition methods provided in an embodiment of the present invention
Structure schematic diagram.Operation has client in the terminal, comprising: test application program 310 and tested application program 320.
Test application program 310 refers to the application program where automatic test code.Test application program 310 is to tested
Application program 320, which is sent, obtains order, which is used to indicate the mesh that tested application program 320 obtains destination Web page
Mark web page element 325.Optionally, test application program 310 by far call browser code RemoteWebUtils311 to
Tested application program 320, which is sent, obtains order.
Tested application program 320 refers to the application program with browsing web page capability, which can be tool
There are application program, instant messaging application program, shopping application program and the payment of the social platform of browsing web page capability using journey
Sequence etc..For example, it is using A that test application program 310, which needs project to be tested, then it is corresponding using A for being tested application program 320
Android version application program.
Tested application program 320 includes host process 321 and subprocess 322, and host process 321 refers to tested application program 320
In be responsible for the process of resource management and/or system interaction, subprocess 322 is also referred to as Web process, refer to be responsible for it is related to Web page
The process of task;Optionally, subprocess 322 is used to execute js script and obtain the target webpage view of destination Web page.
Optionally, each process has the address space of own, and host process and subprocess are mutually indepedent, not shared each
From address space.Schematically, each process includes text filed (text region), data area (data
Region) and at least one of storehouse (stack region), wherein the code that text filed storage processor executes, number
The memory of the dynamic allocation used during storing variable and process execution according to region, and stack region stores active procedure calling
Instruction and local variable.
For the purpose of safety, usually process related with Web page is placed among sandbox, to limit Javascript
Code can only be run in sandbox, to improve the safety of browser.Therefore, in the related art, due to the sandbox mechanism
Presence, host process can not calling interface operation subprocess in resource, to obtain the target webpage element 325 in subprocess.
To solve the above-mentioned problems, in the present embodiment, be provided with host process agency 323 in host process 321, son into
Journey 322 is provided with a sub- process agent 324, establishes communication channel between host process agency 323 and subprocess agency 324, should
Communication channel is the communication channel established according to interprocess communication IPC mechanism, so that host process 321 and subprocess 322 pass through respectively
From process agent can be in communication with each other.Schematically, host process agency is a functional based method being arranged in host process, son
Process agent is a functional based method being arranged in subprocess.
Optionally, IPC mechanism is mainly used for the communication between process, the type of message also there are many kinds of, according to IPC mechanism
The communication channel of foundation acts on behalf of the communication between sub-agent for host process, and the present embodiment is passed to specific by communication channel
Defeated message format does not do excessive explanation then.
Optionally, test application program 310 passes through host process of the RemoteWebUtils311 to tested application program 320
323 transmission of agency obtains order, and host process agency 323 obtains from subprocess agency 324 according to order is obtained, by communication channel
Target webpage element 325 is taken, and returns to the target webpage element 325 to test application program 310.
Optionally, terminal can be mobile phone, tablet computer, E-book reader, MP3 player (Moving Picture
Experts Group Audio Layer III, dynamic image expert's compression standard audio level 3), MP4 (Moving
Picture Experts Group Audio Layer IV, dynamic image expert's compression standard audio level 4) player, knee
Mo(u)ld top half portable computer and desktop computer etc..
Referring to FIG. 4, it illustrates the flow charts of web page element acquisition methods provided by one embodiment of the present invention.This reality
It applies example and is applied to implementation environment illustrated in fig. 3 with the web page element acquisition methods to illustrate.The web page element acquisition side
Method includes:
Step 401, host process agency receives the acquisition order that test application program is sent.
Host process agency of the test application journey into tested application program, which sends, obtains order, which is used to indicate
Tested application program obtains the target webpage element of destination Web page;Corresponding, host process agency receives the acquisition order;Show
Meaning property, obtaining order is command (referred to as: cmd) order.
Optionally, which carries operation mark, which is used to indicate what tested application program obtained
Content type.In a kind of possible embodiment, store that operation mark is corresponding with content type to close in a manner of operating list
System, the operating list are as shown in Table 1.In the operating list, the corresponding content type of operation mark " 01 " is Web page
" web page element ", the corresponding content type of operation mark " 02 " are " uniform resource locator (Uniform of Web page
Resource Locator, URL) link ", the corresponding content type of operation mark " 03 " is " web page title " of Web page.
Table one
Operation mark | Content type |
01 | Web page element |
02 | URL link |
03 | Web page title |
For example, when test application journey to host process agency send acquisition order carry operation mark " 01 ", then lead into
Cheng Daili table one kind inquire content type corresponding with operation mark " 01 " be Web page " web page element ", then lead into
Cheng Daili determines that the content for needing to obtain is the target webpage element of destination Web page.
Step 402, host process agency obtains target webpage from subprocess agency by communication channel according to order is obtained
Element.
Optionally, the cmd order received is forwarded to subprocess agency, subprocess by communication channel by host process agency
Agency obtains the target webpage view in subprocess according to the cmd order, and extracts target webpage from the target webpage view
Element, then acted on behalf of by communication channel to host process and return to target webpage element, host process agency receives the target webpage element.
Wherein, target webpage view is also referred to as target WebView, is the control for loaded and displayed destination Web page.Target
Web page element is also referred to as target Web element, is the web page element extracted from target webpage view.
Step 403, the target webpage element that host process agency will acquire is back to test application program.
Optionally, target webpage element is several web page elements in the target webpage page, including the target webpage page
In at least one of list, OptionButton, check box, list box, input frame, password box, text box and picture.
Optionally, after host process agency receives the target webpage element that subprocess agency sends, to test application program
The target webpage element is returned to, corresponding, test application program receives the target webpage element, and to the target webpage element
It is parsed, and is packaged into target webpage element object.
In conclusion being provided with a subprocess generation in subprocess due to being provided with a host process agency in host process
Reason, the present embodiment act on behalf of the acquisition order for receiving test application program and sending by host process, pass through communication according to order is obtained
Channel obtains target webpage element from subprocess agency, and the target webpage element that will acquire is back to test application program;
So that host process and subprocess are able to carry out the communication between process by respective process agent, host process can pass through host process
Act on behalf of and get target webpage element in subprocess from subprocess agency, thus test application program can receive it is main into
The target webpage element that Cheng Daili is sent, so that test application program can be according to the target webpage element object after encapsulation
Application program is tested to this and carries out automatic test.
Referring to FIG. 5, it illustrates the flow charts of web page element acquisition methods provided by one embodiment of the present invention.This reality
It applies example and is applied to implementation environment shown in figure 1 with the web page element acquisition methods to illustrate.The web page element acquisition side
Method includes:
Step 501, host process agency of the test application journey into tested application program, which sends, obtains order.
Step 502, host process agency receives the acquisition order that test application program is sent.
Step 503, host process agency will acquire order and be sent to subprocess agency by communication channel.
Optionally, host process agency is acted on behalf of to subprocess by communication channel and sends cmd order, and subprocess agency receives
The cmd order.
Due to support Web automatic test code (including execute js script and obtain target webpage view it is related
Logic) belong to test code, if the test code is as to be tested application program right together for this in tested application issued
Outer publication not only will increase the installation kit size of tested application program in this way, but also there is the outgoing due to test code and lead
The security risk of cause.Therefore, in the present embodiment, the code of Web automatic test will be supported to realize in a manner of plug-in card program,
The plug-in card program is not issued when tested application issued, which is in Web automatic test for supporting Web certainly
The program of dynamicization test, so that need to only increase host process agency and subprocess in tested application program acts on behalf of relevant code,
While hardly increasing the installation kit size of tested application program, so that security risk is controllable.
Optionally, host process agency is acted on behalf of to subprocess by communication channel and sends cmd order, and subprocess agency receives
The cmd order.After subprocess agency receives cmd order, detect in terminal whether plug-in card program is installed, if having installed
506 are thened follow the steps, thens follow the steps 504 if detecting and not installing plug-in card program.
Step 504, when detect plug-in card program is not installed when, according in specified directory plug-in unit installation kit install plug-in unit journey
Sequence.
Optionally, it is developed using Android works progress, finally compiling generates plug-in unit installation kit, which is stored in
In the specified directory of terminal.When detect plug-in card program is not installed when, find plug-in unit installation kit in specified directory, and according to
The plug-in unit installation kit installs plug-in card program.
Step 505, third party's Classloader is set by the default Classloader of plug-in card program.
Due to when the corresponding browser kernel of destination Web page be third party define kernel when, the default of plug-in card program
The corresponding automatic test of the webpage view that Classloader does not support third party to define.Therefore, in order to which plug-in card program can be supported
The default Classloader of plug-in card program is set third party's Classloader by above situation, which is third
The Classloader based on default Classloader extension that square Software Development Kit SDK is provided, third party SDK are integrated in target
SDK in Web page.
Step 506, subprocess agency will acquire order and be forwarded to plug-in card program.
Optionally, subprocess agency calls plug-in card program to obtain target webpage element, the plug-in card program according to order is obtained
It is the plug-in card program operated in subprocess.
Step 507, plug-in card program obtains target webpage view according to order is obtained, and extracts mesh from target webpage view
Mark web page element.
Since the corresponding browser kernel of destination Web page is the kernel that provides of operating system or in third party defines
Core, therefore, plug-in card program include but is not limited to following two according to the process for extracting target webpage element from target webpage view
Kind implementation method.
In a kind of possible implementation method, when the corresponding browser kernel of destination Web page is what operating system provided
When kernel, plug-in card program obtains the first webpage view according to order is obtained, and executes the first js script to the first webpage view and obtains
Target webpage element, the first js script are used to extract target webpage element from the first webpage view;Wherein, the first webpage regards
Figure is the webpage view for the default that operating system provides.
Optionally, it is illustrated so that the target webpage page is html page as an example, subprocess passes through first interface calling the
One js script parses all Web elements in html page, at least one Web element is with JSON (JavaScript
Object Notation, JS object tag) character string of format stored, then at least one Web element can by this
Callback method in one interface passes to subprocess.
Optionally, the target webpage element that plug-in card program extracts includes several web page elements, is with json array shape
Formula is stored, and each element in the json array corresponds to a web page element, and the present embodiment is to target webpage element
The data structure form of storage is not limited.
In alternatively possible implementation method, when the corresponding browser kernel of destination Web page is what third party defined
When kernel, plug-in card program obtains the second webpage view for defining of third party according to obtaining to order, and executes the to the second webpage view
Two js scripts obtain target webpage element, and the 2nd js script is used to extract target webpage element from the second webpage view;Wherein,
Second webpage view is the webpage view that third party defines.Correlative detail can refer to the first possible implementation method, herein not
It repeats again.
Step 508, the target webpage element extracted is back to subprocess agency by plug-in card program.
Optionally, plug-in card program by the target webpage element extracted with the character string forms of preset format be back to son into
Cheng Daili;Schematically, preset format is JSON format.
Step 509, subprocess agency receives the target webpage element of plug-in card program passback.
Step 510, the target webpage element that subprocess agency will acquire is back to host process agency by communication channel.
Optionally, the target webpage element that subprocess agency will acquire is back to master with the character string forms of preset format
Process agent.
Step 511, host process agency receives the target webpage element of subprocess agency's passback.
Step 512, the target webpage element that host process agency will acquire is back to the character string forms of preset format
Test application program, preset format refer to the format that preset test application program can parse.
Step 513, test application program receives the target webpage element that host process agency sends.
Step 514, test application program parses target webpage element and is packaged into target webpage element object.
Optionally, target webpage element object includes the text information, attribute information and coordinate information of target webpage element
Deng attribute information includes: the essential attribute of target webpage element object, the Custom Attributes of target webpage element object, target
At least one of the routing information of web page element object in a document.Wherein, the essential attribute packet of target webpage element object
Include mark Id, title Name, classification Class, cascading style list Css and value Value etc.;Target webpage element object is made by oneself
Adopted attribute is that third party is customized " key-value ", and " key " is different customized by third party with essential attribute title;Mesh
Marking the routing information of web page element object in a document is extensible markup language path Xpath information.
In a schematical example, as shown in fig. 6, test application program 610 by RemoteWebUtils611 to
Host process agency 622 in the host process 621 of tested application program 620 sends cmd orders, host process agency 622 pass through IPC to
Subprocess agency 624 in subprocess 623 sends cmd order, and subprocess agency 624 forwards cmd life to plug-in card program 625
It enables, plug-in card program 625 executes js script according to the cmd order, and target webpage member is extracted from the target webpage view 626 of acquisition
Element, and with the storage of JSON array form, and using JSON array as return value, the return value, son are returned to subprocess agency 624
Process agent 624 by IPC transmit the return value to host process agency 622, host process agency 622 obtain the return value it
Afterwards, which is sent to test application program 610, corresponding, test application program 610 parses the return value process,
Target webpage element is obtained, target webpage element is packaged into corresponding target webpage element object.
In conclusion being provided with a subprocess generation in subprocess due to being provided with a host process agency in host process
Reason, the present embodiment act on behalf of the acquisition order for receiving test application program and sending by host process, pass through communication according to order is obtained
Channel obtains target webpage element from subprocess agency, and the target webpage element that will acquire is back to test application program;
So that host process and subprocess are able to carry out the communication between process by respective process agent, host process can pass through host process
Act on behalf of and get target webpage element in subprocess from subprocess agency, thus test application program can receive it is main into
The target webpage element that Cheng Daili is sent, so that test application program can be according to the target webpage element object after encapsulation
Application program is tested to this and carries out automatic test.
The present embodiment also by the way that the code of Web automatic test will be supported to realize in a manner of plug-in card program, is tested application
Whether program the plug-in card program or not when issuing, and acts on behalf of phase with subprocess so that need to only increase host process agency in tested application program
The code of pass, while hardly increasing the installation kit size of tested application program, so that security risk is controllable.
The present embodiment also by when detect plug-in card program is not installed when, according in specified directory plug-in unit installation kit install insert
Part program, and third party's Classloader is set by the default Classloader of plug-in card program, so that when destination Web page is corresponding
When browser kernel is the kernel that third party defines, the Classloader of plug-in card program can support corresponding automatic test, greatly
Tested application program is improved greatly to the coverage of the automatic test of different browser kernels.
Following is apparatus of the present invention embodiment, can be used for executing embodiment of the present invention method.For apparatus of the present invention reality
Undisclosed details in example is applied, embodiment of the present invention method is please referred to.
Referring to FIG. 7, it illustrates the structural schematic diagrams of web page element acquisition device provided by one embodiment of the present invention.
The web page element acquisition device can be by special hardware circuit, alternatively, software and hardware is implemented in combination with as the terminal in Fig. 3
All or part of, which includes: receiving module 710, obtains module 720 and passback module 730.
Receiving module 710, for realizing above-mentioned steps 401 or step 502.
Module 720 is obtained, for realizing above-mentioned steps 402.
Module 730 is returned, for realizing above-mentioned steps 403.
In the alternative embodiment provided based on embodiment illustrated in fig. 7, as shown in figure 8, the acquisition module 720, packet
It includes: transmission unit 721, call unit 722, back propagation unit 723 and receiving unit 724.
Transmission unit 721, for realizing above-mentioned steps 503.
Call unit 722 calls plug-in card program to obtain target webpage element for subprocess agency according to order is obtained,
Plug-in card program is the plug-in card program operated in subprocess.
Back propagation unit 723, for realizing above-mentioned steps 510.
Receiving unit 724, for realizing above-mentioned steps 511.
In the alternative embodiment provided based on embodiment illustrated in fig. 7, as shown in figure 8, the call unit 722, packet
It includes: forwarding subelement 722a, extracting subelement 722b, passback subelement 722c and receiving subelement 722d.
Subelement 722a is forwarded, for realizing above-mentioned steps 506.
Subelement 722b is obtained, for realizing above-mentioned steps 507.
Subelement 722c is returned, for realizing above-mentioned steps 508.
Receiving subelement 722d, for realizing above-mentioned steps 509.
Optionally, when the corresponding browser kernel of destination Web page is the kernel that operating system provides, it is single to extract son
Member is also used to plug-in card program according to order is obtained and obtains the first webpage view, executes the first js script to the first webpage view and obtains
To target webpage element, the first js script is used to extract target webpage element from the first webpage view.
Optionally, when the corresponding browser kernel of destination Web page is the kernel that third party defines, subelement is extracted,
Plug-in card program is also used to according to the second webpage view for ordering and obtaining third party and defining is obtained, second is executed to the second webpage view
Js script obtains target webpage element, and the 2nd js script is used to extract target webpage element from the second webpage view.
In the alternative embodiment provided based on embodiment illustrated in fig. 7, as shown in figure 8, the device, further includes: peace
Die-filling piece 740 and setup module 750.
Module 740 is installed, for realizing above-mentioned steps 504.
Setup module 750, for realizing above-mentioned steps 505.
In the alternative embodiment provided based on embodiment illustrated in fig. 7, as shown in figure 8, the passback module 730, also
For realizing above-mentioned steps 512.
Correlative detail is in combination with reference to Fig. 3 to embodiment of the method shown in fig. 6.Wherein, receiving module 710 is also used to realize
Any other implicit or disclosed function relevant to receiving step in above method embodiment;It obtains module 720 and is also used to reality
Any other implicit or disclosed function relevant to obtaining step in existing above method embodiment;Passback module 730 is also used to
Realize any other implicit or disclosed function relevant to passback step in above method embodiment;Installation module 740 is also used
Any other implicit or disclosed function relevant to installation steps in realization above method embodiment;Setup module 750 is also
For realizing implicit or disclosed function relevant to setting steps any other in above method embodiment.
It should be noted that device provided by the above embodiment, when realizing its function, only with above-mentioned each functional module
It divides and carries out for example, can according to need in practical application and be completed by different functional modules above-mentioned function distribution,
The internal structure of equipment is divided into different functional modules, to complete all or part of the functions described above.In addition,
Apparatus and method embodiment provided by the above embodiment belongs to same design, and specific implementation process is detailed in embodiment of the method, this
In repeat no more.
Referring to FIG. 9, the terminal 900 can wrap it illustrates the block diagram of terminal 900 provided by one embodiment of the present invention
It includes RF (Radio Frequency, radio frequency) circuit 910, include one or more depositing for computer readable storage medium
Reservoir 920, input unit 930, display unit 940, sensor 950, voicefrequency circuit 960, WiFi (wireless fidelity,
Wireless Fidelity) module 970, the processor 980 and the components such as power supply 990 that include one or more than one processing core.
It will be understood by those skilled in the art that device structure shown in Fig. 9 does not constitute the restriction to equipment, it may include than diagram
More or fewer components perhaps combine certain components or different component layouts.Wherein:
RF circuit 910 can be used for receiving and sending messages or communication process in, signal sends and receivees, particularly, by base station
After downlink information receives, one or the processing of more than one processor 980 are transferred to;In addition, the data for being related to uplink are sent to
Base station.In general, RF circuit 910 includes but is not limited to antenna, at least one amplifier, tuner, one or more oscillators, uses
Family identity module (SIM) card, transceiver, coupler, LNA (Low Noise Amplifier, low-noise amplifier), duplex
Device etc..In addition, RF circuit 910 can also be communicated with network and other equipment by wireless communication.Wireless communication, which can be used, appoints
(Global System of Mobile communication, the whole world are moved for one communication standard or agreement, including but not limited to GSM
Dynamic communication system), GPRS (General Packet Radio Service, general packet radio service), CDMA (Code
Division Multiple Access, CDMA), WCDMA (Wideband Code Division Multiple
Access, wideband code division multiple access), LTE (Long Term Evolution, long term evolution), Email, SMS (Short
Messaging Service, short message service) etc..Memory 920 can be used for storing software program and module.Processor 980
It is stored in the software program and module of memory 920, by running thereby executing various function application and data processing.It deposits
Reservoir 920 can mainly include storing program area and storage data area, wherein storing program area can storage program area, at least one
Application program needed for a function (such as sound-playing function, image player function etc.) etc.;Storage data area can store basis
Terminal 900 uses created data (such as audio data, phone directory etc.) etc..In addition, memory 920 may include high speed
Random access memory, can also include nonvolatile memory, a for example, at least disk memory, flush memory device or
Other volatile solid-state parts.Correspondingly, memory 920 can also include Memory Controller, to provide processor 980
Access with input unit 930 to memory 920.
Input unit 930 can be used for receiving the number or character information of input, and generate and user setting and function
Control related keyboard, mouse, operating stick, optics or trackball signal input.Specifically, input unit 930 may include touching
Sensitive surfaces 931 and other input equipments 932.Touch sensitive surface 931, also referred to as touch display screen or Trackpad are collected and are used
Family on it or nearby touch operation (such as user using any suitable object or attachment such as finger, stylus in touch-sensitive table
Operation on face 931 or near touch sensitive surface 931), and corresponding attachment device is driven according to preset formula.It is optional
, touch sensitive surface 931 may include both touch detecting apparatus and touch controller.Wherein, touch detecting apparatus detection is used
The touch orientation at family, and touch operation bring signal is detected, transmit a signal to touch controller;Touch controller is from touch
Touch information is received in detection device, and is converted into contact coordinate, then gives processor 980, and can receive processor 980
The order sent simultaneously is executed.Furthermore, it is possible to using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves
Realize touch sensitive surface 931.In addition to touch sensitive surface 931, input unit 930 can also include other input equipments 932.Specifically,
Other input equipments 932 can include but is not limited to physical keyboard, function key (such as volume control button, switch key etc.),
One of trace ball, mouse, operating stick etc. are a variety of.
Display unit 940 can be used for showing information input by user or be supplied to user information and equipment 90 it is each
Kind graphical user interface, these graphical user interface can be made of figure, text, icon, video and any combination thereof.It is aobvious
Show that unit 940 may include display panel 941, optionally, LCD (Liquid Crystal Display, liquid crystal display can be used
Device), the forms such as OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) configure display panel 941.
Further, touch sensitive surface 931 can be covered on display panel 941, when touch sensitive surface 931 detects on it or nearby
After touch operation, processor 980 is sent to determine the type of touch event, is followed by subsequent processing device 980 according to the class of touch event
Type provides corresponding visual output on display panel 941.Although touch sensitive surface 931 and display panel 941 are to make in Fig. 9
Input and input function are realized for two independent components, but in some embodiments it is possible to by touch sensitive surface 931 and aobvious
Show that panel 941 is integrated and realizes and outputs and inputs function.
Terminal 900 may also include at least one sensor 950, such as optical sensor, motion sensor and other sensings
Device.Specifically, optical sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment
The light and shade of light adjusts the brightness of display panel 941, and proximity sensor can close display when terminal 900 is moved in one's ear
Panel 941 and/or backlight.As a kind of motion sensor, gravity accelerometer can detect in all directions (generally
Three axis) acceleration size, can detect that size and the direction of gravity when static, can be used to identify mobile phone posture application (ratio
Such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap);Extremely
In other sensors such as gyroscope, barometer, hygrometer, thermometer, the infrared sensors that terminal 900 can also configure, herein
It repeats no more.
Voicefrequency circuit 960, loudspeaker 921, microphone 922 can provide the audio interface between user and terminal 900.Audio
Electric signal after the audio data received conversion can be transferred to loudspeaker 921, be converted to sound by loudspeaker 921 by circuit 960
Sound signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 922, after being received by voicefrequency circuit 960
Audio data is converted to, then by after the processing of audio data output processor 980, another equipment is sent to through RF circuit 910, or
Person exports audio data to memory 920 to be further processed.Voicefrequency circuit 960 is also possible that earphone jack, to mention
For the communication of peripheral hardware earphone and terminal 900.
WiFi belongs to short range wireless transmission technology, and terminal 900 can help user's transceiver electronics by WiFi module 970
Mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Fig. 9 is shown
WiFi module 970, but it is understood that, and it is not belonging to must be configured into for terminal 900, it can according to need completely
Do not change in the range of the essence of invention and omits.
Processor 980 is the control centre of terminal 900, utilizes each portion of various interfaces and connection whole equipment
Point, by running or execute the software program and/or module that are stored in memory 920, and calls and be stored in memory 920
Interior data execute the various functions and processing data of terminal 900, to carry out integral monitoring to equipment.Optionally, processor
980 may include one or more processing cores;Optionally, processor 980 can integrate application processor and modem processor,
Wherein, the main processing operation system of application processor, user interface and application program etc., modem processor mainly handles nothing
Line communication.It is understood that above-mentioned modem processor can not also be integrated into processor 980.
Terminal 900 further includes the power supply 990 (such as battery) powered to all parts, it is preferred that power supply can pass through electricity
Management system and processor 980 are logically contiguous, to realize management charging, electric discharge and power consumption by power-supply management system
The functions such as management.Power supply 990 can also include one or more direct current or AC power source, recharging system, power supply event
Hinder the random components such as detection circuit, power adapter or inverter, power supply status indicator.
Although being not shown, terminal 900 can also include camera, bluetooth module etc., and details are not described herein.
Terminal 900 further includes memory, and at least one instruction is stored in the memory, which is loaded simultaneously by processor
Execute the web page element acquisition methods to realize above-mentioned each embodiment of the method offer.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will appreciate that realizing whole or portion in the web page element acquisition methods of above-described embodiment
It may be implemented by hardware step by step, relevant hardware can also be instructed to complete by program, the program can deposit
It is stored in a kind of computer readable storage medium, at least one instruction is stored in the storage medium, which is added by processor
It carries and executes to realize above-mentioned web page element acquisition methods.
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and
Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.
Claims (14)
1. a kind of web page element acquisition methods, which is characterized in that the described method includes:
Host process agency receives the acquisition order that test application program is sent, and the host process agency is arranged tested using journey
Process agent in the host process of sequence, the acquisition order are used to indicate the tested application program and obtain destination Web page
Target webpage element;
The host process agency orders according to the acquisition, obtains the target webpage from subprocess agency by communication channel
Element, the subprocess agency is the process agent being arranged in the subprocess of the tested application program, the communication channel
It is the host process agency established according to interprocess communication IPC mechanism and subprocess communication between agents channel;
The target webpage element that the host process agency will acquire is back to the test application program.
2. passing through the method according to claim 1, wherein host process agency orders according to the acquisition
Communication channel obtains the target webpage element from subprocess agency, comprising:
Acquisition order is sent to the subprocess by the communication channel and acted on behalf of by the host process agency;
The subprocess agency orders according to the acquisition, and plug-in card program is called to obtain the target webpage element, the plug-in unit
Program is the plug-in card program operated in the subprocess;
The target webpage element that the subprocess agency will acquire is back to the host process by the communication channel
Agency;
The host process agency receives the target webpage element of the subprocess agency passback.
3. according to the method described in claim 2, it is characterized in that, subprocess agency calls according to acquisition order
Plug-in card program obtains the target webpage element, comprising:
Acquisition order is forwarded to the plug-in card program by the subprocess agency;
The plug-in card program orders according to the acquisition and obtains target webpage view, and extracts institute from the target webpage view
Target webpage element is stated, the target webpage view is the control for destination Web page described in loaded and displayed;
The target webpage element extracted is back to the subprocess and acted on behalf of by the plug-in card program;
The subprocess agency receives the target webpage element of the plug-in card program passback.
4. according to the method described in claim 3, it is characterized in that, when the corresponding browser kernel of the destination Web page is
When the kernel that operating system provides, the plug-in card program is according to acquisitions order acquisition target webpage view, and from the mesh
The target webpage element is extracted in mark webpage view, comprising:
The plug-in card program orders according to the acquisition and obtains the first webpage view, executes the first js to first webpage view
Script obtains the target webpage element, and the first js script is for extracting the target network from first webpage view
Page element.
5. according to the method described in claim 3, it is characterized in that, when the corresponding browser kernel of the destination Web page is
When the kernel that third party defines, the plug-in card program orders according to the acquisition and obtains target webpage view, and from the target
The target webpage element is extracted in webpage view, comprising:
The plug-in card program regards second webpage according to second webpage view for obtaining order acquisition third party and defining
Figure executes the 2nd js script and obtains the target webpage element, and the 2nd js script from second webpage view for mentioning
Take the target webpage element.
6. method according to any one of claims 1 to 5, which is characterized in that the method, further includes:
When detect the plug-in card program is not installed when, the plug-in card program is installed according to plug-in unit installation kit in specified directory;
Third party's Classloader is set by the default Classloader of the plug-in card program, third party's Classloader is third
The Classloader based on the default Classloader extension that square Software Development Kit SDK is provided, the third party SDK is collection
At the SDK in the destination Web page.
7. method according to any one of claims 1 to 5, which is characterized in that described in the host process agency will acquire
Target webpage element is back to the test application program, comprising:
The target webpage element that the host process agency will acquire is back to the test with the character string forms of preset format
Application program, the preset format refer to the format that the preset test application program can parse.
8. a kind of web page element acquisition device, which is characterized in that described device includes:
Receiving module acts on behalf of the acquisition order for receiving test application program and sending for host process, and the host process agency is to set
The process agent in the host process of tested application program is set, the acquisition order is used to indicate the tested application program and obtains
The target webpage element of destination Web page;
Module is obtained, is ordered for host process agency according to the acquisition, is obtained from subprocess agency by communication channel
The target webpage element is taken, the subprocess agency is the process generation being arranged in the subprocess of the tested application program
Reason, the communication channel are that the host process agency established according to interprocess communication IPC mechanism acts on behalf of it with the subprocess
Between communication channel;
Module is returned, the target webpage element that will acquire for host process agency is back to the test application journey
Sequence.
9. device according to claim 8, which is characterized in that the acquisition module, comprising:
Transmission unit, call unit, back propagation unit and receiving unit;
The acquisition is ordered for host process agency and is sent to the son by the communication channel by the transmission unit
Process agent;
The call unit orders according to the acquisition for subprocess agency, plug-in card program is called to obtain the target
Web page element, the plug-in card program are the plug-in card programs operated in the subprocess;
The back propagation unit, the target webpage element that will acquire for subprocess agency pass through the communication channel
It is back to the host process agency;
The receiving unit receives the target webpage element of the subprocess agency passback for host process agency.
10. device according to claim 9, which is characterized in that the call unit, comprising:
It forwards subelement, extract subelement, passback subelement and receiving subelement;
Acquisition order is forwarded to the plug-in card program for subprocess agency by the forwarding subelement;
The acquisition subelement, for the plug-in card program according to acquisitions order acquisition target webpage view, and from described
The target webpage element is extracted in target webpage view, the target webpage view is for target Web described in loaded and displayed
The control of the page;
The target webpage element extracted is back to the subprocess for the plug-in card program by the passback subelement
Agency;
The receiving subelement receives the target webpage element of the plug-in card program passback for subprocess agency.
11. device according to claim 10, which is characterized in that when the corresponding browser kernel of the destination Web page
When the kernel provided for operating system, the extraction subelement is also used to the plug-in card program and is ordered according to the acquisition obtain
First webpage view executes the first js script to first webpage view and obtains the target webpage element, the first js
Script from first webpage view for extracting the target webpage element.
12. device according to claim 10, which is characterized in that when the corresponding browser kernel of the destination Web page
When the kernel defined for third party, the extraction subelement is also used to the plug-in card program according to acquisition order and obtains the
The second webpage view that tripartite defines executes the 2nd js script to second webpage view and obtains the target webpage element,
The 2nd js script from second webpage view for extracting the target webpage element.
13. a kind of terminal, which is characterized in that the terminal includes processor and memory, is stored at least in the memory
One instruction, described instruction are loaded by the processor and are executed to realize the web page element as described in claim 1 to 7 is any
Acquisition methods.
14. a kind of computer readable storage medium, which is characterized in that be stored at least one instruction, institute in the storage medium
Instruction is stated to be loaded by processor and executed to realize the web page element acquisition methods as described in claim 1 to 7 is any.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710363817.9A CN108959062B (en) | 2017-05-22 | 2017-05-22 | Webpage element acquisition method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710363817.9A CN108959062B (en) | 2017-05-22 | 2017-05-22 | Webpage element acquisition method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108959062A true CN108959062A (en) | 2018-12-07 |
CN108959062B CN108959062B (en) | 2021-06-18 |
Family
ID=64461688
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710363817.9A Active CN108959062B (en) | 2017-05-22 | 2017-05-22 | Webpage element acquisition method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108959062B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111381903A (en) * | 2020-03-18 | 2020-07-07 | 支付宝(杭州)信息技术有限公司 | Program running method, device, equipment and medium |
CN112149033A (en) * | 2020-09-14 | 2020-12-29 | 京东数字科技控股股份有限公司 | Method and device for acquiring H5 page control, electronic equipment and storage medium |
CN113448756A (en) * | 2021-08-30 | 2021-09-28 | 统信软件技术有限公司 | Inter-process communication system and method and computing device |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102982068A (en) * | 2012-10-25 | 2013-03-20 | 北京奇虎科技有限公司 | Method for displaying recommended data and corresponding browser |
CN102999613A (en) * | 2012-11-28 | 2013-03-27 | 北京奇虎科技有限公司 | Method and device for loading tool window in browser |
US20140147051A1 (en) * | 2011-06-30 | 2014-05-29 | American Express Travel Related Services Company, Inc. | Method and system for webpage regression testing |
CN104360936A (en) * | 2014-10-17 | 2015-02-18 | 中国人民解放军国防科学技术大学 | Barrier operation property analysis method based on triggering operation |
CN104639534A (en) * | 2014-12-30 | 2015-05-20 | 北京奇虎科技有限公司 | Website safety information uploading method and browser device |
CN105138448A (en) * | 2014-06-05 | 2015-12-09 | 北京畅游天下网络技术有限公司 | Method and device for page test at front end |
US9351193B2 (en) * | 2009-01-28 | 2016-05-24 | Headwater Partners I Llc | Intermediate networking devices |
CN105867984A (en) * | 2016-04-22 | 2016-08-17 | 广州阿里巴巴文学信息技术有限公司 | Method, device and client for displaying task state in web page as well as mobile equipment |
US20160239880A1 (en) * | 2015-02-17 | 2016-08-18 | Pagefair Limited | Web advertising protection system |
CN106095669A (en) * | 2016-06-03 | 2016-11-09 | 中国矿业大学 | Parallel program testing method based on schedule sequences yojan |
-
2017
- 2017-05-22 CN CN201710363817.9A patent/CN108959062B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9351193B2 (en) * | 2009-01-28 | 2016-05-24 | Headwater Partners I Llc | Intermediate networking devices |
US20140147051A1 (en) * | 2011-06-30 | 2014-05-29 | American Express Travel Related Services Company, Inc. | Method and system for webpage regression testing |
CN102982068A (en) * | 2012-10-25 | 2013-03-20 | 北京奇虎科技有限公司 | Method for displaying recommended data and corresponding browser |
CN102999613A (en) * | 2012-11-28 | 2013-03-27 | 北京奇虎科技有限公司 | Method and device for loading tool window in browser |
CN105138448A (en) * | 2014-06-05 | 2015-12-09 | 北京畅游天下网络技术有限公司 | Method and device for page test at front end |
CN104360936A (en) * | 2014-10-17 | 2015-02-18 | 中国人民解放军国防科学技术大学 | Barrier operation property analysis method based on triggering operation |
CN104639534A (en) * | 2014-12-30 | 2015-05-20 | 北京奇虎科技有限公司 | Website safety information uploading method and browser device |
US20160239880A1 (en) * | 2015-02-17 | 2016-08-18 | Pagefair Limited | Web advertising protection system |
CN105867984A (en) * | 2016-04-22 | 2016-08-17 | 广州阿里巴巴文学信息技术有限公司 | Method, device and client for displaying task state in web page as well as mobile equipment |
CN106095669A (en) * | 2016-06-03 | 2016-11-09 | 中国矿业大学 | Parallel program testing method based on schedule sequences yojan |
Non-Patent Citations (1)
Title |
---|
TYIMAN: ""进程间通信IPC (InterProcess Communication)"", 《HTTPS://WWW.JIANSHU.COM/P/C1015F5FFA74》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111381903A (en) * | 2020-03-18 | 2020-07-07 | 支付宝(杭州)信息技术有限公司 | Program running method, device, equipment and medium |
CN112149033A (en) * | 2020-09-14 | 2020-12-29 | 京东数字科技控股股份有限公司 | Method and device for acquiring H5 page control, electronic equipment and storage medium |
CN113448756A (en) * | 2021-08-30 | 2021-09-28 | 统信软件技术有限公司 | Inter-process communication system and method and computing device |
CN113448756B (en) * | 2021-08-30 | 2021-12-07 | 统信软件技术有限公司 | Inter-process communication system and method and computing device |
Also Published As
Publication number | Publication date |
---|---|
CN108959062B (en) | 2021-06-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104978176B (en) | Application programming interfaces call method, device and computer readable storage medium | |
CN104519485B (en) | Communication means, device and system between a kind of terminal | |
CN106354458B (en) | Double-screen display method and device | |
CN103702297B (en) | Short message enhancement, apparatus and system | |
CN104572690B (en) | A kind of methods, devices and systems obtaining web data | |
CN104571979B (en) | A kind of method and apparatus for realizing split view | |
CN108984548A (en) | Content of pages caching method and device | |
CN106547844B (en) | A kind for the treatment of method and apparatus of user interface | |
CN105389259B (en) | A kind of method, apparatus and system for carrying out Application testing | |
CN107391198B (en) | Method for scheduling task and device, computer readable storage medium, mobile terminal | |
CN108536594A (en) | Page test method, device and storage device | |
CN103336838B (en) | A kind of processing method of webpage, device and terminal device | |
CN104252356A (en) | Interface generating method and system | |
CN104065693A (en) | Method, device and system for accessing network data in webpage applications | |
CN107590397A (en) | A kind of method and apparatus for showing embedded webpage | |
CN105955597A (en) | Method and device for displaying information | |
CN105868319B (en) | Webpage loading method and device | |
CN108959062A (en) | Web page element acquisition methods and device | |
CN105740419A (en) | Method and apparatus for acquiring dynamically loaded content in webpage | |
CN106155888A (en) | The detection method of webpage loading performance and device in a kind of Mobile solution | |
CN105094872B (en) | A kind of method and apparatus showing web application | |
CN104123308B (en) | Webpage generating method and auto-building html files device | |
CN103824003B (en) | application program protecting method, device and terminal | |
CN105354067B (en) | A kind of interface configuration method and device | |
CN110020338A (en) | Browser, webpage deployment method and equipment |
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 |