public List <UngVien> Run(CauHinh ch, List <JobLink> lst_job_link) { is_authenticated = false; List <UngVien> lst_ung_vien = new List <UngVien>(); using (var browser = new XBrowser(user_profile_path, cv_save_path, string.Empty, false, show_browser)) { foreach (var job in lst_job_link) { string url = browser.GoTo(job.link); is_authenticated = url.Contains(ch.url_login) ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out string msg) : browser.GetUrl().Contains(url); if (is_authenticated) { string r_url = browser.GoTo(job.link); if (r_url.Contains(job.link)) { var lst_cv_by_job = XuLyCV(browser, job); lst_ung_vien.AddRange(lst_cv_by_job); job.tong_so_cv = lst_cv_by_job.Count; ES.JobLinkRepository.Instance.UpdateTrangThaiXuLy(job); } } } } return(new List <UngVien>(lst_ung_vien)); }
public List <JobLink> ExtractJobLink(CauHinh ch, string link, string app_id, out string msg) { is_authenticated = false; msg = ""; List <JobLink> lst = new List <JobLink>(); using (var browser = new XBrowser(user_profile_path, string.Empty, false, show_browser)) { string url = browser.GoTo(ch.url_login); string wait_xpath = ".//div[@class='kv_login']/div/span"; System.Threading.Thread.Sleep(2000); var home = browser.GetUrl(); if (browser.Find(wait_xpath).Count > 0) { is_authenticated = true; } else { is_authenticated = home == "https://careerbuilder.vn/vi/employers/hrcentral" || (link != url ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out msg, wait_xpath, false) : browser.GetUrl().Contains(url)); } if (is_authenticated) { browser.GoTo(link); System.Threading.Thread.Sleep(2000); List <string> lst_links = new List <string>(); var ds_tin = browser.Find( "//div[@id='gird_standard']//dd//span[@class='rc_col_title3 info_jobseeker']/a[1]"); foreach (var tin in ds_tin) { var get_tin = browser.GetAttribute(tin, "href"); var ten_job = tin.Text; if (!string.IsNullOrEmpty(get_tin)) { JobLink job = new JobLink(LoaiLink.JOB_LINK) { app_id = app_id, link = get_tin, trang_thai = TrangThai.DANG_SU_DUNG, trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY, nguoi_tao = ch.username, ten_job = ten_job }; lst.Add(job); } } } } return(lst); }
public List <UngVien> Run(CauHinh ch, List <JobLink> lst_job_link, ToolStripStatusLabel label) { is_authenticated = false; List <UngVien> lst_ung_vien = new List <UngVien>(); string wait_xpath = ".//div[@class='kv_login']/div/span"; using (var browser = new XBrowser(user_profile_path, cv_save_path, string.Empty, false, show_browser)) { if (lst_job_link.Count < 1) { label.Text = "Không có tin nào đang được đăng trực tuyến"; } else { foreach (var job in lst_job_link) { string url = browser.GoTo(job.link); is_authenticated = url.Contains(ch.url_login) ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out string msg, wait_xpath, false) : browser.GetUrl().Contains(url); if (is_authenticated) { //string r_url = browser.GoTo(job.link); System.Threading.Thread.Sleep(1000); browser.FindAndClick("//div[@class='top']/ul//div/a"); System.Threading.Thread.Sleep(1000); var lst_url_uv = new List <string>(); var ung_vien = browser.Find(".//form[@id='editFrm1']/dd/span[@class='rc_col_310px info_jobseeker']/div/a"); if (ung_vien.Count > 0) { foreach (var uv in ung_vien) { var url_uv = browser.GetAttribute(uv, "href"); lst_url_uv.Add(url_uv); } } if (lst_url_uv.Count > 0) { foreach (var item in lst_url_uv) { label.Text = $"Đang xử lý link: {job.link}"; browser.GoTo(item); var lst_cv_by_job = XuLyCV(browser, job); lst_ung_vien.AddRange(lst_cv_by_job); } } job.tong_so_cv = lst_url_uv.Count; ES.JobLinkRepository.Instance.UpdateTrangThaiXuLy(job); } } } } return(new List <UngVien>(lst_ung_vien)); }
public List <UngVien> Run(CauHinh ch, List <JobLink> lst_job_link) { is_authenticated = false; List <UngVien> lst_ung_vien = new List <UngVien>(); using (var browser = new XBrowser(user_profile_path, cv_save_path, string.Empty, false, show_browser)) { foreach (var job in lst_job_link) { string url = browser.GoTo(job.link); if (url.Contains(ch.url_login)) { is_authenticated = browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out string msg); } else { is_authenticated = browser.GetUrl().Contains(url); } if (is_authenticated) { string r_url = browser.GoTo(job.link); if (r_url.Contains(job.link)) { var lst_cv_by_job = XuLyCV(browser, job); //Phân trang CV ////ul[@class='pagination']//a var cv_paging_eles = browser.Find("//ul[@class='pagination']//a"); if (cv_paging_eles.Count > 0) { var lst_link_paging = new List <string>(); foreach (var pg_ele in cv_paging_eles) { lst_link_paging.Add(browser.GetAttribute(pg_ele, "href")); } lst_link_paging = lst_link_paging.Distinct().ToList(); foreach (var item in lst_link_paging) { browser.GoTo(item); lst_cv_by_job.AddRange(XuLyCV(browser, job)); ES.JobLinkRepository.Instance.UpdateTrangThaiXuLy(job); } } job.tong_so_cv = lst_cv_by_job.Count; lst_ung_vien.AddRange(lst_cv_by_job); } } } } return(new List <UngVien>(lst_ung_vien)); }
public List <UngVien> Run(CauHinh ch, List <JobLink> lst_job_link, ToolStripStatusLabel toolStripStatusLabel1) { is_authenticated = false; List <UngVien> lst_ung_vien = new List <UngVien>(); string wait_xpath = ".//li[@class='dropdown dropdown-user']"; using (var browser = new XBrowser(user_profile_path, cv_save_path, string.Empty, false, show_browser)) { foreach (var job in lst_job_link) { string url = browser.GoTo(job.link); is_authenticated = url.Contains(ch.url_login) ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out string msg, wait_xpath, false) : browser.GetUrl().Contains(url); if (is_authenticated) { //string r_url = browser.GoTo(job.link); System.Threading.Thread.Sleep(1000); browser.FindAndClick(".//a[@href='#tab2']"); var ung_vien = browser.Find(".//tbody[@id='applied']//strong/a"); var url_detail_uv = new List <string>(); foreach (var uv in ung_vien) { var link_uv = browser.GetAttribute(uv, "href"); url_detail_uv.Add(link_uv); } if (url_detail_uv.Count > 0) { foreach (var u_v in url_detail_uv) { browser.GoTo(u_v); toolStripStatusLabel1.Text = $"Đang xử lý link:{job.link}"; var lst_cv_by_job = XuLyCV(browser, job); lst_ung_vien.AddRange(lst_cv_by_job); } } else { job.trang_thai_xu_ly = TrangThaiXuLy.DA_XU_LY; job.ngay_xu_ly = XUtil.TimeInEpoch(); toolStripStatusLabel1.Text = $"Không tìm thấy ứng viên link:{job.link}"; } job.tong_so_cv = url_detail_uv.Count; ES.JobLinkRepository.Instance.UpdateTrangThaiXuLy(job); } } } return(new List <UngVien>(lst_ung_vien)); }
public List <JobLink> ExtractJobLink(CauHinh ch, string link, string app_id, out string msg) { is_authenticated = false; msg = ""; List <JobLink> lst = new List <JobLink>(); using (var browser = new XBrowser(user_profile_path, string.Empty, false, show_browser)) { string url = browser.GoTo(link); string wait_xpath = ".//a[@data-test-key='accountMenuItem']"; is_authenticated = link != url?browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out msg, wait_xpath, false) : browser.GetUrl().Contains(url); if (is_authenticated) { browser.GoTo(link); var eles = browser.Find("//div[@class='Dashboard__dashboard']//a[@class='JobCard__clickable']"); if (eles != null) { foreach (var item in eles) { var url_tin = browser.GetAttribute(item, "href"); var ten_job = item.FindElement(By.XPath(".//strong[@class='BoldedText__regular JobCard__jobTitle']")).Text; if (!string.IsNullOrEmpty(url_tin)) { JobLink job = new JobLink(LoaiLink.JOB_LINK) { app_id = app_id, link = url_tin, trang_thai = TrangThai.DANG_SU_DUNG, trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY, nguoi_tao = ch.username, ten_job = ten_job }; lst.Add(job); } } } } } return(lst); }
public List <JobLink> ExtractJobLink(CauHinh ch, string link, string app_id, out string msg) { is_authenticated = false; msg = ""; List <JobLink> lst = new List <JobLink>(); using (var browser = new XBrowser(user_profile_path, string.Empty, false, show_browser)) { string url = browser.GoTo(link); string wait_xpath = ".//span[@id='currentCredit']"; is_authenticated = url.Contains(ch.url_login) ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out msg, wait_xpath, false) : browser.GetUrl().Contains(url); if (is_authenticated) { browser.GoTo(link); var eles = browser.Find("//tbody[@class='tbody-job']//td[3]/a"); if (eles.Count > 0) { foreach (var item in eles) { var url_tin = browser.GetAttribute(item, "href"); if (!string.IsNullOrEmpty(url_tin)) { JobLink job = new JobLink(LoaiLink.JOB_LINK); job.app_id = app_id; job.link = url_tin; job.trang_thai = TrangThai.DANG_SU_DUNG; job.trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY; job.nguoi_tao = ch.username; lst.Add(job); } } } } } return(lst); }
public List <UngVien> Run(CauHinh ch, List <JobLink> lst_job_link) { is_authenticated = false; List <UngVien> lst_ung_vien = new List <UngVien>(); using (var browser = new XBrowser(user_profile_path, cv_save_path, string.Empty, false, show_browser)) { foreach (var job in lst_job_link) { string url = browser.GoTo(job.link); string wait_xpath = ".//div[@class='icon_menu user-info text-center']"; if (url.Contains(ch.url_login) || browser.GetUrl() == "https://mywork.com.vn/") { is_authenticated = browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out string msg, wait_xpath, true); } else { is_authenticated = browser.GetUrl().Contains(url); } if (is_authenticated) { string r_url = browser.GoTo(job.link); System.Threading.Thread.Sleep(3000); if (r_url.Contains(job.link)) { int sleep = 30000; var find_ung_vien = browser.Find(".//div/span[text()='Không có dữ liệu']"); if (find_ung_vien.Count < 1) { while (sleep > 0) { sleep -= 500; System.Threading.Thread.Sleep(500); List <string> lst_cv_ung_vien = new List <string>(); var lst_cv_by_job = new List <UngVien>(); var lst_new = browser.Find("//table[@class='el-table__body']//tbody//div/div/div[1]/a"); if (lst_new.Count < 1) { job.thong_tin_xu_ly = Common.KHONG_TIM_THAY_UNG_VIEN; } var element = browser.Find("//ul[@class='pagination']//a"); if (element.Count > 0) { var cv_paging_eles = element.Where(x => x.Text != null && x.Text != "Trang trước" && x.Text != "Trang sau"); if (cv_paging_eles.Count() > 0) { var all_links_in_page = new List <string>(); var links_process = new List <string>(); foreach (var pg_ele in cv_paging_eles) { browser.Click(pg_ele); System.Threading.Thread.Sleep(2000); lst_new = browser.Find("//table[@class='el-table__body']//tbody//div/div/div[1]/a"); foreach (var lst_ung_vien_new in lst_new) { var url_ung_vien = browser.GetAttribute(lst_ung_vien_new, "href"); links_process.Add(url_ung_vien); } } foreach (var item in links_process) { browser.GoTo(item); System.Threading.Thread.Sleep(3000); lst_cv_by_job.AddRange(XuLyCV(browser, job, item)); } } } else { var current_href = new List <string>(); foreach (var item in lst_new) { var url_ung_vien = browser.GetAttribute(item, "href"); current_href.Add(url_ung_vien); } foreach (var items in current_href) { browser.GoTo(items); lst_cv_by_job.AddRange(XuLyCV(browser, job, items)); job.tong_so_cv = lst_cv_by_job.Count; } } if (lst_new != null && lst_new.Count > 0) { sleep = 0; } job.tong_so_cv = lst_cv_by_job.Count; job.ngay_xu_ly = XMedia.XUtil.TimeInEpoch(); job.trang_thai_xu_ly = TrangThaiXuLy.DA_XU_LY; lst_ung_vien.AddRange(lst_cv_by_job); ES.JobLinkRepository.Instance.UpdateTrangThaiXuLy(job); } } } } } } return(new List <UngVien>(lst_ung_vien)); }
public List <JobLink> ExtractJobLink(CauHinh ch, string link, string app_id, out string msg) { is_authenticated = false; msg = ""; List <JobLink> lst = new List <JobLink>(); using (var browser = new XBrowser(user_profile_path, string.Empty, false, show_browser)) { string url = browser.GoTo("https://mywork.com.vn/nha-tuyen-dung/dang-nhap"); string wait_xpath = ".//div[@class='icon_menu user-info text-center']"; System.Threading.Thread.Sleep(2000); var home = browser.GetUrl(); is_authenticated = home == "https://mywork.com.vn/" || (link != url ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out msg, wait_xpath, false) : browser.GetUrl().Contains(url)); if (is_authenticated) { browser.GoTo(link); System.Threading.Thread.Sleep(5000); List <string> lst_links = new List <string>(); var cv_paging_eles = browser.Find("//ul[@class='page-01-lst']//a").Where(x => x.Text != "Trang trước" && x.Text != "Trang sau"); if (cv_paging_eles.Count() > 0) { var lst_link_paging = new List <string>(); foreach (var pg_ele in cv_paging_eles) { browser.Click(pg_ele); System.Threading.Thread.Sleep(3000); var e = browser.Find(".//ul[@class='jobslist-01-ul']/li/div/div/ul/li[1]/a"); try { foreach (var item_href in e) { var ten_job = item_href.Text; var url_tin = browser.GetAttribute(item_href, "href"); lst_links.Add(url_tin); if (!string.IsNullOrEmpty(url_tin)) { JobLink job = new JobLink(LoaiLink.JOB_LINK) { app_id = app_id, link = url_tin, trang_thai = TrangThai.DANG_SU_DUNG, trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY, nguoi_tao = ch.username, ten_job = ten_job }; lst.Add(job); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } } } } } return(lst); }
public List <JobLink> ExtractJobLink(CauHinh ch, List <string> lst_link, string app_id, out string msg) { is_authenticated = false; msg = ""; List <JobLink> lst = new List <JobLink>(); string wait_xpath = ".//li[@class='dropdown dropdown-user']"; //ch.username = "******"; //ch.password = "******"; using (var browser = new XBrowser(user_profile_path, string.Empty, false, show_browser)) { foreach (var link in lst_link) { string url = browser.GoTo(link); is_authenticated = link != url?browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out msg, wait_xpath, false) : browser.GetUrl().Contains(url); browser.GoTo(link); try { var find_modal = browser.Find("//div[@id='modal']"); if (find_modal.Count > 0) { foreach (var modal in find_modal) { modal.FindElement(By.ClassName("close"))?.Click(); } } } catch (Exception e) { Console.WriteLine(e.Message); } if (is_authenticated) { var check_paging = browser.Find(".//ul[@class='pagination']/li/a"); if (check_paging.Count() > 0) { var list_url_page = new List <string>(); foreach (var loop in check_paging) { var url_page = browser.GetAttribute(loop, "href"); list_url_page.Add(url_page); } list_url_page = list_url_page.Distinct().ToList(); foreach (var go_url in list_url_page) { browser.GoTo(go_url); System.Threading.Thread.Sleep(1500); var eles_paging = browser.Find(".//table[@class='kv-grid-table table table-hover table-bordered table-striped']//tbody/tr/td[2]/strong/a[@title='Xem chi tiết việc làm và các ứng viên']"); if (eles_paging.Count > 0) { foreach (var item in eles_paging) { var url_tin = browser.GetAttribute(item, "href"); var ten_job = item.Text; if (!string.IsNullOrEmpty(url_tin)) { var job = new JobLink(LoaiLink.JOB_LINK) { app_id = app_id, link = url_tin, trang_thai = TrangThai.DANG_SU_DUNG, trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY, nguoi_tao = ch.username, ten_job = ten_job }; lst.Add(job); } } } } } else { var eles = browser.Find(".//table[@class='kv-grid-table table table-hover table-bordered table-striped']//tbody/tr/td[2]/strong/a[@title='Xem chi tiết việc làm và các ứng viên']"); if (eles.Count > 0) { foreach (var item in eles) { var url_tin = browser.GetAttribute(item, "href"); var ten_job = item.Text; if (!string.IsNullOrEmpty(url_tin)) { JobLink job = new JobLink(LoaiLink.JOB_LINK) { app_id = app_id, link = url_tin, trang_thai = TrangThai.DANG_SU_DUNG, trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY, nguoi_tao = ch.username, ten_job = ten_job }; lst.Add(job); } } } } } } } return(lst); }
public List <JobLink> ExtractJobLink(CauHinh ch, string link, string app_id, out string msg) { is_authenticated = false; msg = ""; List <JobLink> lst = new List <JobLink>(); using (var browser = new XBrowser(user_profile_path, string.Empty, false, show_browser)) { string url = browser.GoTo(link); string wait_xpath = ".//a[@class='user-image']"; is_authenticated = url.Contains(ch.url_login) ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out msg, wait_xpath, false) : browser.GetUrl().Contains(url); if (is_authenticated) { browser.GoTo(link); var eles_tin_tuyen_dung = browser.Find("//form[@id='employer-job-manage']//a[contains(@href,'thu-xin-viec-da-nhan')]"); if (eles_tin_tuyen_dung != null) { foreach (var item in eles_tin_tuyen_dung) { var ten_job = item.FindElement(By.XPath(".//parent::div/parent::div/parent::div/parent::div/following-sibling::div/ul[@class='fa-ul']//li[1]")).Text; var url_tin = browser.GetAttribute(item, "href"); if (!string.IsNullOrEmpty(url_tin)) { JobLink job = new JobLink(LoaiLink.JOB_LINK) { app_id = app_id, link = url_tin, trang_thai = TrangThai.DANG_SU_DUNG, trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY, nguoi_tao = ch.username, ten_job = ten_job }; lst.Add(job); } } } var ele_paging = browser.Find("//ul[@class='pagination']//a"); if (ele_paging != null) { var lst_url_paging = new List <string>(); foreach (var ele in ele_paging) { lst_url_paging.Add(browser.GetAttribute(ele, "href")); } lst_url_paging = lst_url_paging.Distinct().ToList(); foreach (var lnk_paging in lst_url_paging) { browser.GoTo(lnk_paging); eles_tin_tuyen_dung = browser.Find("//form[@id='employer-job-manage']//a[contains(@href,'thu-xin-viec-da-nhan')]"); if (eles_tin_tuyen_dung != null) { foreach (var item in eles_tin_tuyen_dung) { var ten_job = item.FindElement(By.XPath("//parent::div/parent::div/parent::div/parent::div/following-sibling::div/ul[@class='fa-ul']//li[1]")).Text; var url_tin = browser.GetAttribute(item, "href"); if (!string.IsNullOrEmpty(url_tin)) { JobLink job = new JobLink(LoaiLink.JOB_LINK); job.app_id = app_id; job.link = url_tin; job.trang_thai = TrangThai.DANG_SU_DUNG; job.trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY; job.nguoi_tao = XMedia.XUtil.DecodeToken(ch.username); job.ten_job = ten_job; lst.Add(job); } } } } } } } lst = lst.GroupBy(x => x.link).Select(s => s.First()).ToList(); return(lst); }
public bool ExtractThongTin(CauHinh ch, string link, UngVienJobModel.ChiTietTinModel ct, string app_id, out string msg, bool is_debug = false) { msg = ""; is_authenticated = false; using (var browser = new XBrowser(user_profile_path, string.Empty, false, is_debug)) { string url = browser.GoTo(ch.url_login); string wait_xpath = ".//div[@class='kv_login']/div/span"; System.Threading.Thread.Sleep(2000); var home = browser.GetUrl(); if (browser.Find(wait_xpath).Count > 0) { is_authenticated = true; } else { is_authenticated = home == "https://careerbuilder.vn/vi/employers/hrcentral" || (link != url ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out msg, wait_xpath, false) : browser.GetUrl().Contains(url)); } browser.GoTo(link); if (is_authenticated) { _logger.Info("LOGIN CAREER BUILDER SUCCESS"); try { var form_post = browser.Find("//div[@id='tab-postjob-description']"); if (form_post.Count > 0) { foreach (var element in form_post) { var chuc_danh = element.FindElement(By.Id("job_title")); if (chuc_danh != null) { chuc_danh.SendKeys(ct.chuc_danh); _logger.Info("da sendkeys chuc danh"); } else { _logger.Error("khong tim thay xpath chuc danh"); } var mo_ta_cv = element.FindElement(By.XPath(".//iframe[@title='Rich Text Editor, job_desc']")); if (mo_ta_cv != null) { mo_ta_cv.SendKeys(ct.mo_ta_cong_viec); _logger.Info("da sendkeys mo ta cong viec"); } else { _logger.Error("khong tim thay xpath mo ta cong viec"); } var yeu_cau_cv = element.FindElement(By.XPath(".//iframe[@title='Rich Text Editor, job_req']")); if (yeu_cau_cv != null) { yeu_cau_cv.SendKeys(ct.yeu_cau_cong_viec); _logger.Info("da sendkeys yeu cau cong viec"); } else { _logger.Error("khong tim thay xpath yeu cau cong viec"); } var nganh_nghe = element.FindElement( By.XPath("//div[@class='fl_left width_202 box_multiSelect_industry']/button")); if (nganh_nghe != null) { nganh_nghe.Click(); foreach (var nn in ct.nganh_nghe) { //browser.FindAndClick($"//li/label/span[text()='{nn}']/preceding-sibling::input"); var find_nn = browser .Find($"//li/label/span[text()='{nn}']/preceding-sibling::input")?.First(); if (find_nn != null) { find_nn.Click(); _logger.Info($"da chon nganh nghe {nn}"); } } } else { _logger.Error("khong tim thay xpath nganh nghe"); } // // địa chỉ var dia_chi = browser .Find( $"//select[@name='LOCATION_ID[]']/optgroup[@label='Việt Nam']/option[text()='{ct.dia_chi}']") ?.First(); if (dia_chi != null) { dia_chi.Click(); _logger.Info($"da chon dia chi {ct.dia_chi}"); } else { _logger.Error("khong tim thay dia chi"); } var btn_add_work = browser.Find("//a[@onclick='addWorkLocation();']")?.First(); if (btn_add_work != null) { btn_add_work.Click(); var ins_dia_chi = browser .Find($"//select[@id='location_id']/option[text()='{ct.dia_chi}']")?.First(); if (ins_dia_chi != null) { ins_dia_chi.Click(); _logger.Info($"da chon dia chi moi la {ct.dia_chi}"); var ins_district = browser .Find($"//select[@id='sldistrict']/option[text()='{ct.district}']") ?.First(); if (ins_district != null) { ins_district.Click(); _logger.Info($"da chon quan {ct.district}"); } else { _logger.Info($"khong tim thay quan {ct.district}"); } } else { _logger.Error($"khong tim thay dia chi {ct.dia_chi}"); } foreach (var address in browser.Find("//input[@id='address']")) { address.SendKeys(ct.dia_chi_chi_tiet); } var save_address = browser.Find("//input[@value='Lưu']")?.First(); if (save_address != null) { save_address.Click(); _logger.Info("da luu dia chi moi tao"); } } else { _logger.Error("khong tim thay button tao dia chi"); } System.Threading.Thread.Sleep(3000); var dia_diem_lam_viec = browser.Find("//input[@value='Địa điểm làm việc']")?.First(); if (dia_diem_lam_viec != null) { dia_diem_lam_viec.Click(); System.Threading.Thread.Sleep(3000); var detail = browser .Find($".//ul[@class='chosen-results']/li[text()='{ct.dia_chi_chi_tiet}']") ?.First(); if (detail != null) { detail.Click(); _logger.Info($"da chon dia chi lam viec: {ct.dia_chi_chi_tiet}"); } else { browser.FindAndClick("//input[@value='Địa điểm làm việc']"); System.Threading.Thread.Sleep(3000); detail.Click(); _logger.Info($"da chon lai dia chi lam viec {ct.dia_chi_chi_tiet}"); } _logger.Info($"da chon dia diem lam viec {ct.dia_chi_chi_tiet}"); } char[] cut_luong = { ',', '/', '-', ' ' }; var arr_luong = ct.muc_luong.Split(cut_luong, StringSplitOptions.RemoveEmptyEntries); var luong_from = arr_luong[0]; var luong_to = arr_luong[1]; var luong_f = element.FindElement(By.Id("salary_from")); if (luong_f != null) { luong_f.SendKeys(luong_from + "000000"); _logger.Info("da sendkeys luong from"); } else { _logger.Error("khong tim thay xpath luong from"); } var luong_t = element.FindElement(By.Id("salary_to")); if (luong_t != null) { luong_t.SendKeys(luong_to + "000000"); _logger.Info("da sendkeys luong to"); } else { _logger.Error("khong tim thay xpath luong from"); } // hình thức làm việc var hinh_thuc_lam_viec = browser .Find( $"//div/label/span[text()='{ct.loai_hinh_cong_viec}']/preceding-sibling::input") ?.First(); if (hinh_thuc_lam_viec != null) { hinh_thuc_lam_viec.Click(); _logger.Info($"da sendkeys hinh thuc lam viec {ct.loai_hinh_cong_viec}"); } else { _logger.Error("khong tim thay xpath hinh thuc lam viec"); } // hạn nhận hồ sơ browser.removeAttrById("JOB_LASTDATE", "readonly"); //element.FindElement(By.Id("JOB_LASTDATE")) // .SendKeys(DateTime.Now.Date.AddMonths(1).ToString("dd/MM/yyyy")); var deadline = element.FindElement(By.Id("JOB_LASTDATE")); if (deadline != null) { deadline.SendKeys(DateTime.Now.Date.AddMonths(1).ToString("dd/MM/yyyy")); _logger.Info("da sendkeys han nhan ho so"); } else { _logger.Info("khong tim thay xpath han nhan ho so"); } // kinh nghiệm JOB_ISEXPERIENCE //browser.FindAndClick( // $"//select[@id='JOB_ISEXPERIENCE']/option[text()='{ct.yeu_cau_kinh_nghiem}']"); var kinh_nghiem = browser .Find($"//select[@id='JOB_ISEXPERIENCE']/option[text()='{ct.yeu_cau_kinh_nghiem}']") ?.First(); if (kinh_nghiem != null) { kinh_nghiem.Click(); _logger.Info($"da chon kinh nghiem {ct.yeu_cau_kinh_nghiem}"); if (ct.yeu_cau_kinh_nghiem == "Có kinh nghiệm") { if (!string.IsNullOrEmpty(ct.kinh_nghiem_from) && !string.IsNullOrEmpty(ct.kinh_nghiem_to)) { var min_year_exp = browser.Find("//input[@id='JOB_FROMEXPERIENCE']"); foreach (var min in min_year_exp) { min.SendKeys(Keys.Control + "a"); min.SendKeys(ct.kinh_nghiem_from); } var max_year_exp = browser.Find("//input[@id='JOB_TOEXPERIENCE']"); foreach (var max in max_year_exp) { max.SendKeys(Keys.Control + "a"); max.SendKeys(ct.kinh_nghiem_to); } } } } else { _logger.Error("khong tim thay xpath kinh nghiem lam viec"); } // cấp bậc làm việc LEVEL_ID var level = browser.Find($"//select[@id='LEVEL_ID']/option[text()='{ct.cap_bac}']") ?.First(); if (level != null) { level.Click(); _logger.Info("da chon cap bac lam viec"); } else { _logger.Error("khong tim thay xpath cap bac lam viec"); } //input[@value='Lưu và Tiếp tục'] browser.FindAndClick("//input[@value='Lưu và Tiếp tục']"); _logger.Info("da luu va tiep tuc buoc 2"); } var save = browser.Find( "//div[@id='tab-postjob-contactinformation']//div[@class='btn_submit']//input")?.First(); if (save != null) { save.Click(); _logger.Info("da click nut submit"); } else { _logger.Error("khong tim thay nut submit"); } System.Threading.Thread.Sleep(3000); var post_job = browser.Find("//div[@id='tab-postjob-matchingscore']//div[@class='btn_submit']//input")?.First(); if (post_job != null) { post_job.Click(); _logger.Info("post job thanh cong"); } System.Threading.Thread.Sleep(3000); var url_tin = browser.GetUrl(); _logger.Info($"lay url job thanh cong: {url_tin}"); List <JobLink> lst_saved = new List <JobLink>(); JobLink saved = new JobLink(LoaiLink.JOB_LINK) { ten_job = ct.chuc_danh, app_id = app_id, link = url_tin, trang_thai = TrangThai.DANG_SU_DUNG, trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY, nguoi_tao = ch.username }; lst_saved.Add(saved); _logger.Info("post tin careerbuilder thanh cong"); return(ES.JobLinkRepository.Instance.IndexMany(lst_saved) > 0); } } catch (Exception ex) { _logger.Error(ex); } } } return(false); }