def job1(useid, password): #通过python自带的模块判断是不是节假日 nowTime = datetime.date(datetime.datetime.now().year, datetime.datetime.now().month, datetime.datetime.now().day) print(is_workday(nowTime)) if is_workday(nowTime): print('Its weekday') driver = WebChrome() driver.implicitly_wait(20) driver.get( "http://sso.portal.unicom.local/eip_sso/aiportalLogin.html?appid=na186&success=http://service.aiportal.unicom.local/ssoclient/ssologin&error=http://sso.portal.unicom.local/eip_sso/aiportalLogin.html&return=http://sso.portal.unicom.local/eip_sso/aiportalLogin.html" ) driver.find_element_by_id('login').send_keys(useid) driver.find_element_by_id('password').send_keys(password) driver.find_element_by_xpath("//button[@class='login_botton']").click() driver.find_element_by_xpath( "//div[@class='pan' and @label='人力资源2.0']").click() driver.switch_to_new_tab() driver.find_element_by_xpath( "//a[@class = 'gn_block gn_block1']").click() driver.switch_to_new_tab() driver.find_element_by_xpath( "//button[@class='ant-btn sign-btn signout ant-btn-primary']" ).click() driver.quit() else: print('Its holiday')
sleep(1) driver.find_element_by_xpath("/html/body/div[6]/div/div/ul/li").click() sleep(1) #导出 #driver.find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/div/div[3]/div/div[2]/div/button").click() #sleep(2) #搜索 driver.find_element_by_xpath("//input[@placeholder='请输入宝贝名称搜索']").send_keys( "2段") sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div/div[2]/div[2]/div/div/div/button" ).click() sleep(1) #查看违规截图 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div[2]/div/div/div[3]/table/tbody/tr/td[7]/div/a" ).click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div[3]/div/div[2]/div/div/div/div[3]/table/tbody/tr[2]/td[3]/div/div//a[@class = 'candy-a-link']" ).click() sleep(1) driver.switch_to_new_tab() sleep(1) driver.switch_to_previous_tab() sleep(1)