zhilianceshi

 1 #-*- coding:utf-8 -*-
 2 from selenium import webdriver
 3 import requests
 4 from time import *
 5 
 6 class Zhilian():
 7     def __init__(self,keywords,education,working_life,update_date):
 8         self.keywords=keywords
 9         self.education=education
10         self.working_life=working_life
11         self.update_date=update_date
12 
13     def login(self):
14         # 打开浏览器
15         self.driver=webdriver.Chrome()
16         #self.driver=webdriver.Firefox()
17         self.driver.maximize_window()
18         self.driver.implicitly_wait(10)
19         #self.url='https://www.baidu.com'
20         self.url='https://passport.zhaopin.com/org/login'
21         self.driver.get(self.url)
22         # 登录智联
23         self.driver.find_element_by_id("loginName").send_keys("ozrgjhwsz013")
24         self.driver.find_element_by_id("password").send_keys("ldxy@201806")
25         sleep(30)
26         self.driver.find_element_by_id("loginbutton").click()
27 
28     def quit(self):
29         sleep(5)
30         self.driver.quit()
31 
32     def search(self):
33         bs=self.driver
34         # 输入关键词
35         bs.find_element_by_xpath('//a[@href="//rd5.zhaopin.com/search"]').click()
36         bs.find_element_by_xpath('//*[@id="form-item--1"]/div/input').send_keys(self.keywords)
37         # 选择学历
38         bs.find_element_by_xpath('//*[@id="form-item-12"]/div[1]/div/span/span/i[1]').click()
39         bs.find_element_by_xpath(u'//li[@data-label="%s"]/span'%self.education).click()
40         # 选择工作年限
41         bs.find_element_by_xpath('//*[@id="form-item-13"]/div[1]/div/span/span/i[1]').click()
42         bs.find_element_by_xpath(u'//li[@data-label="%s"]/span'%self.working_life).click()
43         # 选择更新日期
44         bs.find_element_by_xpath('//*[@id="form-item-38"]/div/div/span/span/i[1]').click()
45         bs.find_element_by_xpath(u'//li[@data-label="%s"]/span'%self.update_date).click()
46         # 人才搜索
47         bs.find_element_by_xpath('//*[@id="resume-filter-form"]/div[2]/div/button[3]').click()
48 
49     def result_screening(self):
50         pass
51 
52 if __name__=='__main__':
53     # 关键词
54     keywords='java'
55     # 学历
56     education='大专'
57     # 工作年限
58     working_life='1年'
59     # 更新日期
60     update_date='最近三天'
61     driver=Zhilian(keywords,education,working_life,update_date)
62     driver.login()
63     driver.search()

猜你喜欢

转载自www.cnblogs.com/liuyun66535309/p/9175545.html
今日推荐