此脚本用appium来写的一个boss直聘自动化招聘工具,容易上手,有着遍历人才库,匹配自己设定的岗位关键字,岗位关键字可以在excel里面输入,代码读取excel,然后自动匹配在线简历,匹配成功则私信要附件简历,这个是1.0需求,1.1需求还有遍历消息列表,下载简历,转发钉钉。此版本运用了pytest框架,失败了可以自动拉起 缺点:被boss直聘检测出为第三方插件,在脚本运行的时候会退出登陆,但是不会封号,各位可以一起讨论一下这个事情
import random
from time import sleep
import numpy as np
from appium import webdriver
from appium.webdriver.common.appiumby import AppiumBy
import pytest
import pandas as pd
class TestCommentdeletion:
@pytest.mark.flaky(reruns=100 , reruns_delay=5)
def testconnecttowachat(self):
desire = {
"platformName": "Android", # 设置安卓 固定的
"platformVersion": "11", # 安卓版本号
"autoAcceptAlerts": True, # 授权弹窗
"appPackage": "com.hpbr.bosszhipin", # 设置包名
"appActivity": "com.hpbr.bosszhipin.module.launcher.WelcomeActivity", # 设置启动文件名
"deviceName": "FEC0220428003691",
"automationName": "UIAutomator2",
"noReset": True,
'resetKeyboard': True
}
server ='http://localhost:4723/wd/hub'
driver = webdriver.Remote(server,desire)
sleep(random.uniform(1,5))
while True:
driver.find_element(AppiumBy.ID,'//*[@resource-id="com.hpbr.bosszhipin:id/iv_tab_3"]').click()#点击进入消息
sleep(random.uniform(5,8))
driver.find_element(AppiumBy.ID,'//*[@resource-id="com.hpbr.bosszhipin:id/iv_tab_3"]').click()#点击进入牛人
sleep(random.uniform(5,10))
width = driver.get_window_size()['width']
height = driver.get_window_size()['height']
sleep(random.uniform(1,5))
driver.swipe(width * 0.2, height * 0.3, width * 0.4, height * 0.1, 1000)
driver.tap([(55, 721),(1025,760)],300)
sleep(1)
self.yin =driver.find_element(AppiumBy.XPATH,'//*[@resource-id="com.hpbr.bosszhipin:id/tv_geek_name"]').text
sleep(random.uniform(1,2.5))
print(f'进入{self.yin}简历详情页')
self.a = []
n = driver.find_element(AppiumBy.ID, 'com.hpbr.bosszhipin:id/tv_geek_description')
self.a = n.text
print(self.a)
while True:
tou = driver.find_elements(AppiumBy.XPATH,'//*[@text="教育经历"]')
if tou ==[]:
sleep(random.uniform(1,3))
width = driver.get_window_size()['width']
height = driver.get_window_size()['height']
sleep(random.uniform(1,3))
driver.swipe(width * 0.5, height * 0.9, width * 0.5, height * 0.1, 1000)
lie = driver.find_elements(AppiumBy.ID, 'com.hpbr.bosszhipin:id/tv_work_desc')
for r in lie:
self.c=r.text
print(self.c)
elif tou!=[]:
sleep(random.uniform(1,3))
data = pd.read_excel(r'C:\Users\midong\Desktop\conditon.xlsx', header=None)
ss = data.head()
t = ss.values
self.r = t[0]
print(self.r)
h = all([False for i in self.r if i in (self.c, self.a)])
for i in self.r:
if i in self.c or i in self.a:
sleep(random.uniform(1,2))
driver.find_element(AppiumBy.XPATH,'//*[@text="立即沟通"]').click()
sleep(random.uniform(1,3))
driver.find_element(AppiumBy.XPATH,'//*[@text="新消息"]').send_keys('你好,我们是华南做短视频带货比较快的公司,正诚聘编导,方便发一下简历吗')
sleep(random.uniform(1,3))
driver.find_element(AppiumBy.XPATH,'//*[@resource-id="com.hpbr.bosszhipin:id/chat_functions"]/android.widget.LinearLayout[1]/android.widget.ImageView[1]').click()
sleep(random.uniform(1,3))
driver.find_element(AppiumBy.ID,'com.hpbr.bosszhipin:id/iv_back').click()
sleep(random.uniform(1,2))
driver.find_element(AppiumBy.ID,'com.hpbr.bosszhipin:id/iv_back').click()
print(f'已经回复{self.yin}应聘者了')
width = driver.get_window_size()['width']
height = driver.get_window_size()['height']
sleep(random.uniform(1,2))
driver.swipe(width * 0.2, height * 0.3, width * 0.4, height * 0.1, 1000)
sleep(random.uniform(1,3))
break
else:
driver.find_element(AppiumBy.ID,'com.hpbr.bosszhipin:id/iv_back').click()
print('下一个招聘者')
sleep(2)
break
break
if __name__ == '__main__':
pytest.main(['testwei.py', '-vs'])
版权声明:本文为qq_46223732原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。