A kind of method of automatic reprinting related news information
Technical field
The invention belongs to a kind of extensions in computer automated testing field, for the Domestic News on quick obtaining network
And it reprints to a kind of method in oneself platform.
Background technique
There are many things to merit attention, a large-scale Internet company, for some daily in the world
Significant events report is all relatively more timely, because they have abundant manpower resource specially to do this thing.Little company has very much can
It can update slow.Like be me company, also have information notice on website, but be not to have update daily, content is total
It is so several, so few users browse.
In the communication with responsible maintenance personnel, it is found that the Domestic News that they safeguard all turn to have in automatic network substantially
's.And they have fixed source.Only they really go to safeguard without so much energy.Check what maintenance personnel provided
Behind website, it is found that the interface layout of these websites is very regular, be well suited for the operation of automation tools, then an idea is just
It is born in this way: writes the manual operations that a set of automatic test script goes substitution maintenance personnel.
Summary of the invention
The purpose of the present invention is the angles of subsidiary company operation to set out, and provides a kind of automatic side for reprinting related news information
Method.It reprints the specific Domestic News content in certain website automatically by script, is published on the website of oneself.
The technical solution adopted by the present invention to solve the technical problems includes the following steps:
Step 1, starting 2 browser B1 and B2, browser B1 open certain Website page and obtain education information, browser B2
Open oneself website maintenance Domestic News page.
Step 2, the title B1-T1 that appointed sequence number Domestic News on the page are obtained on browser B1, pause behaviour's browser
Make B1, start-up operation browser B2.
Step 3, browser B2 open oneself website maintenance Domestic News page, scan for T1 as title, if
T1 is not present in browser B2, suspends browser B2, and starting browser B1 operation further clicks on and opens title B1-T1 chain
It connects, obtains the detailed information T1-M1 of the page, comprising: source, text.If needing to save line by line there are picture in T1-M1
Text, and it is the discovery that a flag F lag=1 is in the position of picture, and download pictures are to locally.Suspend browser B1, starts clear
The device B2 that lookes at operation.If T1 is existing in browser B2, step 2 is returned to, continues to obtain next new news.
Start newly-increased Domestic News B2-T2 in step 4, browser B2, by the corresponding maintenance of information of T1-M1 into B2-T2,
If detecting Flag=1 in text during maintenance, it is inserted into corresponding picture, is saved after completing information input.Suspend clear
Look at device B2, starting browser B1 operation obtains next new T1 in browser B1, is then return to step 2 operation.
Step 5 has all existed until B1-T1 in browser B2, while having suspended the operation of browser B1 and B2, waits
Return step 1 after longer period of time T starts a new wheel operation.
The reason of waiting longer period of time T is: 1, B1 will not frequent updating Domestic News;2, excessively frequently access B1,
It may be considered to attack by B1, to refuse to service.
The present invention has the beneficial effect that:
1, the maintenance real-time of oneself Website News information is significantly improved.
2, it by obtaining the Domestic News of more different web sites, is more enriched before content ratio, attracts the pass of more users
Note.
Specific embodiment
Below with reference to embodiment, the invention will be further described.
A kind of method of automatic reprinting related news information, concrete methods of realizing are as follows:
Step 1, starting 2 browser B1 and B2, browser B1 open certain Website page and obtain education information, browser B2
Open oneself website maintenance Domestic News page.
Step 2, the title B1-T1 that appointed sequence number Domestic News on the page are obtained on browser B1, pause behaviour's browser
Make B1, start-up operation browser B2.
Step 3, browser B2 open oneself website maintenance Domestic News page, scan for T1 as title, if
T1 is not present in browser B2, suspends browser B2, and starting browser B1 operation further clicks on and opens title B1-T1 chain
It connects, obtains the detailed information T1-M1 of the page, comprising: source, text.If needing to save line by line there are picture in T1-M1
Text, and it is the discovery that a flag F lag=1 is in the position of picture, and download pictures are to locally.Suspend browser B1, starts clear
The device B2 that lookes at operation.If T1 is existing in browser B2, step 2 is returned to, continues to obtain next new news.
Start newly-increased Domestic News B2-T2 in step 4, browser B2, by the corresponding maintenance of information of T1-M1 into B2-T2,
If detecting Flag=1 in text during maintenance, it is inserted into corresponding picture, is saved after completing information input.Suspend clear
Look at device B2, starting browser B1 operation obtains next new T1 in browser B1, is then return to step 2 operation.
Step 5 has all existed until B1-T1 in browser B2, while having suspended the operation of browser B1 and B2, waits
Return step 1 after longer period of time T starts a new wheel operation.
The reason of waiting longer period of time T is: 1, B1 will not frequent updating Domestic News;2, excessively frequently access B1,
It may be considered to attack by B1, to refuse to service.