29/12/12

Tự động lấy tin tuyển dụng từ tuyendung.com.vn bằng WebAutomation

Sau đây là ví dụ minh họa về chức năng tự động lấy tin của Web Automation, chương trình sẽ lấy tấc cả tin tuyển dụng từ trang tuyendung.com.vn


Nhập đoạn code sau vào khung Mã Lệnh:


clearlog();
resetlistwebsite();
go("http://tuyendung.com.vn/timvieclam/jobresult.aspx");
sleep(5, false);
browser("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/div/table/tbody/tr/td[2]/div/table");

Nhập đoạn code sau vào khung Mẫu:

var a = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/div/table/tbody/tr[2]/td[2]/div/span[@id='ctl00_ContentPlaceHolder1_lblCompanyName']");
var b = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/div/table/tbody/tr[2]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblCompanyProfile']");
var c = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/div/table/tbody/tr[2]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblCompanySize']");
var d = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/div/table/tbody/tr[2]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblCompanyAddress']");
var e = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/div/table/tbody/tr[2]/td[2]/a[@id='ctl00_ContentPlaceHolder1_hplWebsite']");
var f = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div/table/tbody/tr/td[2]/span/span[@id='ctl00_ContentPlaceHolder1_lblJobTitle']");
var g = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[2]/div[2]/span[@id='ctl00_ContentPlaceHolder1_lblJobDescription']");
var h = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[3]/table/tbody/tr/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblMinYearOfExp']");
var i = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[3]/table/tbody/tr[2]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblMinLevel']");
var j = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[3]/table/tbody/tr[3]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblMinEdutcation']"); var k = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[3]/table/tbody/tr[4]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblJobSkills']");
var l = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblJobPosition']");
var m = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[2]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblJobNo']");
var n = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[3]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblExpLevel']");
var o = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[4]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblReqNumber']"); var p = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[5]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblRangeOfAge']");
var q = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[6]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblGender']"); var r = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[7]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblWorkingType']");
var s = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[8]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblSalary']");
var t = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[9]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblWorkLocation']");
var u = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[10]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblJobIndustry']"); var v = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[@id='ctl00_ContentPlaceHolder1_trBenefits']/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblBenefits']");
var x = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[@id='ctl00_ContentPlaceHolder1_trProfileConsist']/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblProfileConsist']");
var y = extract("/html/body/div/form[@id='aspnetForm']/div[@id='Main']/div[@id='contents']/table[2]/tbody/tr/td[3]/div/div[@id='GeneralTemp']/table/tbody/tr/td/div[4]/table/tbody/tr[13]/td[2]/span[@id='ctl00_ContentPlaceHolder1_lblClosedDate']");

var cty_name = toObject(a).innerText;
var cty_description = toObject(b).innerText;
var cty_size = toObject(c).innerText;
var cty_address = toObject(d).innerText;
var cty_website = (toObject(e).firstChild != null ? toObject(e).firstChild.href : '');
var job_title = toObject(f).innerText;
var job_description = toObject(g).innerText;
var job_min_year = toObject(h).innerText;
var job_min_level = toObject(i).innerText;
var job_min_eduction = toObject(j).innerText;
var job_skill = toObject(k).innerText;
var job_position = toObject(l).innerText;
var job_number = toObject(m).innerText;
var job_exp_level = toObject(n).innerText;
var job_req_number = toObject(o).innerText;
var job_age = toObject(p).innerText;
var job_gender = toObject(q).innerText;
var job_working_type = toObject(r).innerText;
var job_salary = toObject(s).innerText;
var job_location = toObject(t).innerText;
var job_industry = toObject(u).innerText;
var job_benefit = toObject(v).innerText;
var job_profile_consist = toObject(x).innerText;
var job_close_date = toObject(y).innerText;

var text = cty_name + cty_description + cty_size + cty_address + cty_website + job_title + job_description + job_min_year + job_min_level + job_min_eduction + job_skill + job_position + job_number + job_exp_level + job_req_number + job_age + job_gender + job_working_type + job_salary + job_location + job_industry + job_benefit + job_profile_consist + job_close_date;

var xml = "";

xml += "\n\n";
xml += "\t\n";
xml += "\t\t<![CDATA["+ cty_name +"]]>\n";
xml += "\t\t<![CDATA["+ cty_description +"]]>\n";
xml += "\t\t<![CDATA["+ cty_size +"]]>\n";
xml += "\t\t<![CDATA["+ cty_address +"]]>\n";
xml += "\t\t<![CDATA["+ cty_website +"]]>\n";
xml += "\t\t<![CDATA["+ job_title +"]]>\n";
xml += "\t\t<![CDATA["+ job_description +"\n";
xml += "\t\t<![CDATA["+ job_min_year +"]]>\n";
xml += "\t\t<![CDATA["+ job_min_level +"]]>\n";
xml += "\t\t<![CDATA["+ job_min_eduction +"]]>\n";
xml += "\t\t<![CDATA["+ job_position +"]]>\n";
xml += "\t\t<![CDATA["+ job_number +"]]>\n";
xml += "\t\t<![CDATA["+ job_exp_level +"]]>\n";
xml += "\t\t<![CDATA["+ job_req_number +"]]>\n";
xml += "\t\t<![CDATA["+ job_age +"]]>\n";
xml += "\t\t<![CDATA["+ job_gender +"]]>\n";
xml += "\t\t<![CDATA["+ job_working_type +"]]>\n";
xml += "\t\t<![CDATA["+ job_salary +"]]>\n";
xml += "\t\t<![CDATA["+ job_location +"]]>\n";
xml += "\t\t<![CDATA["+ job_industry +"]]>\n";
xml += "\t\t<![CDATA["+ job_benefit +"]]>\n";
xml += "\t\t<![CDATA["+ job_profile_consist +"]]>\n";
xml += "\t\t<![CDATA["+ job_close_date +"]]>\n";
xml += "\t
\n";
xml += "
\n";

if(text != '')
{
log(xml);
log("");
}

Nhấn nút chạy và nhấn vào tab Xem trước để xem kết quả

Để chạy chương trình bạn cần tải và làm làm theo hướng dẫn tại link sau: http://www.thangdc.com/2012/12/phan-mem-viet-web-automation.html

Chia sẻ
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...

0 nhận xét

 
© 2011 Phần mềm việt - Công nghệ 24h - congnghe24h - phanmemviet
Designed by BlogThietKe Cooperated with Duy Pham
Released under Creative Commons 3.0 CC BY-NC 3.0
Chính sáchĐiều khoản
Back to top