Zhaopin refresh resume

Source: Internet
Author: User
Tags http 200

At the request of a student, he wrote a script to refresh his or her resume, saving him from having to refresh his resume during the interview.

The main tool is casperjs!

1. capserjs program:

1> access a self-developed iframe combination page (Verification code identification page + smart link logon page)

2> write the verification code on the smart link page into the verification code recognition page and submit it.

3> enter the characters returned from the verification code recognition page in the verification code box on the Zhilian page, enter the user name and password, and click "Log on ".

4> wait for the page to jump and click the refresh button

5> Click Refresh in a loop

[Dongsong @ localhost js_study] $ cat zhilian. js var logPrint = true; var icDir = '/tmp/raw_codes/'; function GUID () {var S4 = function () {return Math. floor (Math. random () * 0x10000/* 65536 */). toString (16) ;}; return (S4 () + S4 () + "-" + S4 () + "-" + S4 () + "-" + S4 () + "-" + S4 () + S4 () + S4 ();} function debug (st) {require ('utils '). dump (st);} function check_arg (casper, fileName) {if (! Casper. cli. has ("username") |! Casper. cli. has ("passwd") |! Casper. cli. has ("starturl") {console. log ("\ nUsage: \ n \ tcasperjs" + fileName + "-- starturl = http://www.centos6.com: 9000/mainapp/customized_iframe -- username = xx -- passwd = xx \ n"); casper. exit () ;}} function refresh () {this. wait (10000, function () {this. click ('a [title = "resume refresh"] '); this. log ('refreshed my resume ');}); this. run (refresh);} function main_navigation () {// create the casper object var casper = require ("casper "). Create ({verbose: logPrint, logLevel: "debug", onError: function (self, m) {this. capture ("error.png"); console. log ("FATAL:" + m); self. exit () ;}, onTimeout: function (self) {this. log ('entire casper navigation timeout', 'error');}, timeout: 86400 // the execution time of the entire script cannot exceed one day}); // check the check_arg parameter (casper, "zhilian. js "); var starturl = casper. cli. get ("starturl"); var userName = casper. cli. get ("username"); var pas SWd = casper. cli. get ("passwd"); var icFile = null; // casper. start (starturl + '? AimUrl = '+ encodeURIComponent ("http://my.zhaopin.com/myzhaopin/resume_index.asp"), function then () {this. page. switchToChildFrame (0) ;}); // wait for the verification code casper. waitFor (function check () {if (this. visible ('img [id = "vimg"] ') {this. log ('identifying code appears'); icFile = icDir + GUID () + '.png '; // bounds = this. getElementBounds ('img [node-type = "pincode"] '); // this.capture('whole_for_render_completed.png'); // t His.capture('code_for_render_completed.png ', {top: bounds ['top'], left: bounds ['left'], width: bounds ['width'], height: bounds ['height']}); // this. capture (icFile, {top: bounds ['top'] + 7, left: bounds ['left'] + 7, width: bounds ['width'], height: bounds ['height']}); // added calibration this. captureSelector (icFile, 'img [id = "vimg"] '); this. page. switchToParentFrame (); this. page. switchToChildFrame (1); this. fill ('form # icform ', {'pic File ': icFile}, true); return true;} else {this. log ('identifying code does not appear ') return false ;}}, function then () {}, function onTimeout () {this. log ('timeout: oauth form still exists and identifying code does not appear ', 'error') ;}, timeout = 30000); // obtain the verification code character casper. waitFor (function check () {if (this. exists ('H') {recognizedCode = this. fetchText ('H'); this. log ('result code is '+ r EcognizedCode); this. page. switchToParentFrame (); this. page. switchToChildFrame (0); this. fill ('form [name = "frmLogin"] ', {'loginname': userName}, false); this. fill ('form [name = "frmLogin"] ', {'Password': passWd}, false); this. fill ('form [name = "frmLogin"] ', {'validate': recognizedCode}, false); this. click ('input [id = "loginbutton"] '); return true;} else {this. log ('Waiting for recognized string ', 'debug'); re Turn false ;}}, function then () incluthis.capture('filled.png ') ;}, function onTimeout () {this. log ('timeout: waiting for recognized string ', 'error') ;}, timeout = 1000000); // wait until the page jumps and click the refresh button casper. waitForSelector ('a [title = "resume refresh"] ', function () {this.capture('to_click.png'); this. click ('a [title = "resume refresh"] ') ;}, function onTimeout () {this. log ('wait form failed', 'error');}, timeout = 10000); // loop: Refresh your resume within a certain period of time (using waitFor and wait to achieve a loop, it seems that it is not reliable !) /* Casper. waitFor (function check () {this. wait (10000, function () {this. click ('a [title = "resume refresh"] '); this. log ('refreshed my resume ') ;}); return false ;}, function then () {}, function onTimeout () {this. log ('timeout: refresh loop competed. ', 'error') ;}, timeout = 120000); * // launch the navigation casper. run (refresh);} main_navigation ();

Result:

[Dongsong @ localhost js_study] $ casperjs Zhilian. JS -- username = "xxx@gmail.com" -- passwd = "XXXX" -- starturl = "http: // localhost: 9000/mainapp/customized_iframe" [info] [phantom] starting... [info] [phantom] execution timeout set to 86400000 Ms [info] [phantom] running suite: 5 steps [debug] [phantom] opening URL: http: // localhost: 9000/mainapp/customized_iframe? Aimurl = http % 3A % 2f % found % 2 fmyzhaopin % 2fresume_index.asp, http get [debug] [phantom] navigation requested: url = http: // localhost: 9000/mainapp/customized_iframe? Aimurl = http://my.zhaopin.com/myzhaopin/resume_index.asp, type = Other, lock = true, ismainframe = true [debug] [phantom] URL changed to "http: // localhost: 9000/mainapp/customized_iframe? Aimurl = http://my.zhaopin.com/myzhaopin/resume_index.asp "[debug] [phantom] navigation requested: url = http://my.zhaopin.com/myzhaopin/resume_index.asp, type = Other, lock = true, ismainframe = false [debug] [phantom] navigation requested: url = http: // localhost: 9000/mainapp/fileform, type = Other, lock = true, ismainframe = false [debug] [phantom] navigation requested: url = http://my.zhaopin.com/loginmgr/login.asp? Bkurl =/myzhaopin/resume_index.asp ?, Type = Other, lock = true, ismainframe = false [debug] [phantom] successfully injected Casper client-side utilities [info] [phantom] Step 2/5 http: // localhost: 9000/mainapp/customized_iframe? Aimurl = http://my.zhaopin.com/myzhaopin/resume_index.asp (HTTP 200) [info] [phantom] Step 2/5: Done In 9751 Ms. [debug] [phantom] successfully injected Casper client-side utilities [info] [phantom] Step 3/5 http://my.zhaopin.com/loginmgr/login.asp? Bkurl =/myzhaopin/resume_index.asp? (HTTP 200) [info] [phantom] Step 3/5: Done In 9853 Ms. [debug] [phantom] identifying code appears [debug] [phantom] capturing page to/home/dongsong/js_study/login [info] [phantom] capture saved to/home/dongsong/ js_study/whole_for_render_completed.png [debug] [phantom] capturing page to/tmp/raw_codes/login with cliprect {"height ": 27, "Left": 941, "TOP": 223, "width ": 72} [info] [phantom] capture saved to/tmp/raw_codes/warn [debug] [phantom] successfully injected Casper client-side utilities [info] [remote] attempting to fetch form element from selector: 'form # icform '[debug] [remote] Set "picfile" field value to/tmp/raw_codes/81358a65-119e-c715-53e5-617fdbf31c9.png [info] [remote] Submitting form to/mainapp/R Ecognize, http post [info] [phantom] waitfor () finished in 352 Ms. [debug] [phantom] navigation requested: url = http: // localhost: 9000/mainapp/recognize, type = formsubmitted, lock = true, ismainframe = false [debug] [phantom] successfully injected Casper client-side utilities [info] [phantom] Step 4/6 http: // localhost: 9000/mainapp/recognize (HTTP 200) [info] [phantom] Step 4/6: Done In 62320 Ms. [info] [phantom] Step 5/6 http: // localhost: 9000/mainapp/recognize (HTTP 200) [info] [phantom] Step 5/6: Done In 62418 Ms. [debug] [phantom] result code is dl5k [info] [remote] attempting to fetch form element from selector: 'form [name = "frmlogin"] '[debug] [remote] Set "loginname" field value to dongsong.xu@gmail.com [info] [remote] attempting to fetch form element from selector: 'form [name = "frmlogin"] '[debug] [remote] Set "password" field value to ******** [info] [remote] attempting to fetch form element from selector: 'form [name = "frmlogin"] '[debug] [remote] Set "Validate" field value to dl5k [debug] [phantom] mouse event 'click' on selector: input [ID = "loginbutton"] [info] [phantom] waitfor () finished in 201 Ms. [info] [phantom] Step 6/7 http://my.zhaopin.com/loginmgr/login.asp? Bkurl =/myzhaopin/resume_index.asp? (HTTP 200) [debug] [phantom] capturing page to/home/dongsong/js_study/filled.png [info] [phantom] capture saved to/home/dongsong/js_study/filled.png [info] [phantom] step 6/7: done in 62941 Ms. [info] [phantom] Step 7/7 http://my.zhaopin.com/loginmgr/login.asp? Bkurl =/myzhaopin/resume_index.asp? (HTTP 200) [info] [phantom] Step 7/7: Done In 62946 Ms. [debug] [phantom] navigation requested: url = http://my.zhaopin.com/loginmgr/loginproc.asp, type = formsubmitted, lock = true, ismainframe = false [debug] [phantom] successfully injected Casper client-side utilities [debug] [phantom] navigation requested: url = http://my.zhaopin.com/myzhaopin/resume_index.asp ?, Type = Other, lock = true, ismainframe = false [debug] [phantom] successfully injected Casper client-side utilities [debug] [phantom] navigation requested: url = http://my.zhaopin.com/MYZHAOPIN/new_register_tracking.asp, type = Other, lock = true, ismainframe = false [info] [phantom] waitfor () finished in 6367 Ms. [info] [phantom] Step 8/8 http://my.zhaopin.com/myzhaopin/resume_index.asp? (HTTP 200) [debug] [phantom] capturing page to/home/dongsong/js_study/to_click.png [info] [phantom] capture saved to/home/dongsong/js_study/to_click.png [debug] mouse event 'click' on selector: A [Title = "resume refresh"] [debug] [phantom] navigation requested: url = http://my.zhaopin.com/myzhaopin/resume_index.asp? #, Type = linkclicked, lock = true, ismainframe = false [info] [phantom] Step 8/8: Done In 72774 Ms. [info] [phantom] Done 8 steps in 72774 Ms [info] [phantom] running suite: 9 steps [info] [phantom] Step 9/9 http://my.zhaopin.com/myzhaopin/resume_index.asp? # (HTTP 200) [info] [phantom] Step 9/9: Done In 72876 Ms. [info] [phantom] Wait () finished waiting for 10000 ms. [debug] [phantom] mouse event 'click' on selector: A [Title = "resume refresh"] [debug] [phantom] refreshed my resume [info] [phantom] done 9 steps in 82898 Ms [info] [phantom] running suite: 10 steps [info] [phantom] Step 10/10 http://my.zhaopin.com/myzhaopin/resume_index.asp? # (HTTP 200) [info] [phantom] Step 10/10: Done In 83000 Ms. [info] [phantom] Wait () finished waiting for 10000 ms. [debug] [phantom] mouse event 'click' on selector: A [Title = "resume refresh"] [debug] [phantom] refreshed my resume [info] [phantom] done 10 steps in 93041 Ms [info] [phantom] running suite: 11 steps [info] [phantom] Step 11/11 http://my.zhaopin.com/myzhaopin/resume_index.asp? # (HTTP 200) [info] [phantom] Step 11/11: Done In 93144ms. ^ C

2. Background verification code recognition program 1

Provide the aforementioned iframe combination page

Page for submission of verification code: After receiving the image file from post, you can send it to the target Email Address by email and scan the cracking characters corresponding to the image in the database. After scanning the characters, it is returned to the browser.

3. Background verification code recognition program 2

Log on to the email address that sends the verification code, regularly scan for new emails (30 s), and update the cracking characters of the verification code to the database.

4. Verification Code cracking: You need to manually read the verification code image in the email and reply to the email with common characters.

The procedures 2 and 3 involve a lot of files and won't be pasted out. According to the above ideas, writing by yourself is not very difficult.

Paste a refresh:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.