from selenium import webdriver

import webbrowser

import time,datetime

import random

import configparser

#自动获取次日,如果有需要可以用这段

# def getday(msg,default=1):

# r=input(msg)

# if r=='':

# return default

# return r

#在指定位置读取文件

cf = configparser.ConfigParser()

cf.read(r"D:\Program Files (x86)\config.ini")

namee = cf.get("conf", "Na")

passd = cf.get("conf", "Pa")

Hour = cf.getint("conf", "H")

M1 = cf.getint("conf", "M1")

M2 = cf.getint("conf", "M2")

XB = cf.get("conf", "XB")

tdate = cf.getint("conf", "Interval")

ZD = cf.get("conf", "ZD")

DATE1 = cf.get("conf", "DATE1")

today = datetime.date.today()

h = int(Hour)

m = random.randint(M1, M2)

s = random.randint(0, 59)

if ZD=='on' :

D1 = DATE1.split('-', 2)

halloween = datetime.datetime(int(D1[0]), int(D1[1]), int(D1[2]), h, m, s)

# tdate = int(getday("请输入间隔天:"))

else:

tomorrow = today + datetime.timedelta(days=tdate)

halloween = datetime.datetime(tomorrow.year, tomorrow.month, tomorrow.day, h, m, s)

print(halloween)

while datetime.datetime.now() < halloween:

time.sleep(1)

browser = webdriver.Chrome()

browser.get('http://登陆链接/Login')

time.sleep(2)

browser.find_element_by_id("UserName").clear()

browser.find_element_by_id("UserName").send_keys(namee)

browser.find_element_by_id("PassWord").send_keys(passd)

browser.find_element_by_css_selector("[type=submit]").click()

time.sleep(1)

if XB=="on":

browser.find_element_by_class_name("btn").click()

time.sleep(2)

browser.switch_to_alert().accept()

time.sleep(3)

print('done')

# browser.close()

browser.quit()

"""

放置驱动

C:\Program Files\Python36\Scripts

https://npm.taobao.org/mirrors/chromedriver

打包

cd D:\python_study\打包\XBLS14

D:

pyinstaller -F -i test.ico test.py

-----------------------------------------------

D:\Program Files (x86)\config.ini

[conf]

Interval=1

Na=你的用户名

Pa=密码

H=8

M1=44

M2=58

#下班填入on或者其它

XB=ond

#指定日期on或者其它

ZD=on4

DATE1=2019-10-08

"""

python 员工考勤_用python写的考勤自动打卡程序相关推荐

  1. python 时间序列预测_使用Python进行动手时间序列预测

    python 时间序列预测 Time series analysis is the endeavor of extracting meaningful summary and statistical ...

  2. python 概率分布模型_使用python的概率模型进行公司估值

    python 概率分布模型 Note from Towards Data Science's editors: While we allow independent authors to publis ...

  3. 用python读取股票价格_使用Python写一个量化股票提醒系统

    大家在没有阅读本文之前先看下python的基本概念, Python是一种解释型.面向对象.动态数据类型的高级程序设计语言. Python由Guido van Rossum于1989年底发明,第一个公开 ...

  4. python机器学习预测_使用Python和机器学习预测未来的股市趋势

    python机器学习预测 Note from Towards Data Science's editors: While we allow independent authors to publish ...

  5. python 查询包_查找Python包的依赖包(语句)

    Window 10家庭中文版,Python 3.6.4, 今天看完了urllib3的官文(官方文档),因为没有具体使用过,所以,仍然是一知半解,但是,突然想知道 urllib3以及前面学习过的requ ...

  6. python希腊字母字符串_#10 Python字符串

    前言 通过上一节可知,Python6个序列的内置类型中,最常见的是列表和元组,但在Python中,最常用的数据类型却不是列表和元组,而是字符串.要想深入了解字符串,必须先掌握字符编码问题.因此本篇博文 ...

  7. 使用python预测基金_使用python先知3 1创建预测

    使用python预测基金 This tutorial was created to democratize data science for business users (i.e., minimiz ...

  8. python 创意项目_针对python开发人员的10个很棒的python项目创意

    python 创意项目 The joy of coding Python should be in seeing short, concise, readable classes that expre ...

  9. python异步教程_【Python 异步编程入门】

    本文是写给 JavaScript 程序员的 Python 教程. Python 的异步编程,其他人可能觉得很难,但是 JavaScript 程序员应该特别容易理解,因为两者的概念和语法类似.JavaS ...

  10. python selenium截图_利用 Python + Selenium 实现对页面的指定元素截图(可截长图元素)...

    对WebElement截图 WebDriver.Chrome自带的方法只能对当前窗口截屏,且不能指定特定元素.若是需要截取特定元素或是窗口超过了一屏,就只能另辟蹊径了. WebDriver.Phant ...

最新文章

  1. 熵的定义(很好的方法论工具尤其第三熵增益的计算)
  2. 论文回顾:U2-Net,由U-Net组成的U-Net
  3. matlab GM(2,1)模型
  4. 联想创投子公司国民认证,助力农行全面升级FIDO移动生物识别安全认证
  5. aspx repeater 用法_ASP.NET - Repeater 控件
  6. 2020年前端最火的技术是什么?
  7. Android 布局管理器 之 TableLayout
  8. 卸载mscs、活动目录、dns方法
  9. 浅析C++开发工程师的高薪就业方向
  10. JOBDU 1108 堆栈的使用
  11. sql注入的闭合方式
  12. 基于Matlab/Simulink的1/4车辆系统动力学模型的两种建模方法(动力学建模入门知识)
  13. 马斯克入驻推特造成大恐慌!这俩戏精还冒充被裁员工,外媒全被耍了
  14. 马云收购士兰微_2019中国500强民企榜单出炉!阿里第一腾讯第二
  15. 做人的十三条黄金玉律
  16. CSDN如何搜索自己的博客;使用Google搜索自己的博客
  17. 《你要如何衡量你的人生》笔记与感想(二)时光在流逝,而你失去了什么
  18. 在Kmplayer中添加sub字幕过大而挡住视频的解决方法
  19. 大数据集群失联问题解决方案
  20. 【学员心得】如何三招通关云计算HCIE认证

热门文章

  1. 题目1131:合唱队形(最长递增子序列进阶)
  2. webtest 文章
  3. 转:SQL:外连接on条件与where条件的区别
  4. jquery 的队列queue
  5. IModelBinder
  6. 如何抓取所有域用户的hash(win2008--win2012)
  7. Silverlight中使用MVVM(9)-绑定Enum类型数据
  8. 转一些SIFT代码链接
  9. 52 - 算法 - LeetCode 28 - 实现 strStr() -kmp
  10. 10-算法 快速排序