当前位置:网站首页>Time format record
Time format record
2022-07-03 06:15:00 【Bobo AI leaves work】
import time
time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time()))
picture_time = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time()))
driver.get_screenshot_as_file('D:\\pycharm\\PyCharm Community Edition 2021.1.3\\jbr\\bin\\pythonProject\\pythonProject23\\images\\'+picture_time+'.png')
picture_time = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time()))
driver.get_screenshot_as_file('D:\\pycharm\\PyCharm Community Edition 2021.1.3\\jbr\\bin\\pythonProject\\pythonProject23\\images\\'+picture_time+'.png')
ima_time = str(time.time()).replace(".", "_")
driver.save_screenshot('.\\baidu4.png')
# Screenshot mode 2
# coding=utf-8
from selenium import webdriver
import os
import time
# Generate year month day hour minute second time
picture_time = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time()))
directory_time = time.strftime("%Y-%m-%d", time.localtime(time.time()))
print(picture_time)
print(directory_time)
# Print file directory
print(os.getcwd())
# Gets the directory of the current file , And check if there is directory_time Folder , If it does not exist, it will be automatically created directory_time file
try:
File_Path = os.getcwd() + '\\' + directory_time + '\\'
if not os.path.exists(File_Path):
os.makedirs(File_Path)
print(" Directory creation succeeded :%s" % File_Path)
else:
print(" directory already exists !!!")
except BaseException as msg:
print(" Failed to create new directory :%s" % msg)
driver = webdriver.Chrome()
driver.get("https://baidu.com/")
try:
url=driver.save_screenshot('.\\' + directory_time + '\\' + picture_time + '.png')
print("%s : Screenshot successful !!!" % url)
except BaseException as pic_msg:
print(" Screenshot failed :%s" % pic_msg)
time.sleep(2)
driver.quit()
边栏推荐
- Use abp Zero builds a third-party login module (I): Principles
- 【C#/VB.NET】 将PDF转为SVG/Image, SVG/Image转PDF
- 88. 合并两个有序数组
- Kubernetes notes (I) kubernetes cluster architecture
- Kubernetes notes (IV) kubernetes network
- Leetcode problem solving summary, constantly updating!
- Simple solution of small up main lottery in station B
- Cesium 点击获取模型表面经纬度高程坐标(三维坐标)
- Project summary --2 (basic use of jsup)
- Skywalking8.7 source code analysis (II): Custom agent, service loading, witness component version identification, transform workflow
猜你喜欢
Simple handwritten ORM framework
Code generator - single table query crud - generator
Kubernetes notes (10) kubernetes Monitoring & debugging
Kubesphere - Multi tenant management
Cesium Click to obtain the longitude and latitude elevation coordinates (3D coordinates) of the model surface
Core principles and source code analysis of disruptor
CKA certification notes - CKA certification experience post
.NET程序配置文件操作(ini,cfg,config)
Jedis source code analysis (II): jediscluster module source code analysis
Kubernetes notes (VI) kubernetes storage
随机推荐
Project summary --01 (addition, deletion, modification and query of interfaces; use of multithreading)
PMP notes
Alibaba cloud OOS file upload
Leetcode solution - 02 Add Two Numbers
Reinstalling the system displays "setup is applying system settings" stationary
智牛股项目--04
认识弹性盒子flex
Zhiniu stock project -- 04
Judge whether the date time exceeds 31 days
Click cesium to obtain three-dimensional coordinates (longitude, latitude and elevation)
. Net program configuration file operation (INI, CFG, config)
使用 Abp.Zero 搭建第三方登录模块(一):原理篇
Kubesphere - build Nacos cluster
有意思的鼠標指針交互探究
There is no one of the necessary magic skills PXE for old drivers to install!!!
Selenium ide installation recording and local project maintenance
Advanced technology management - do you know the whole picture of growth?
Detailed explanation of findloadedclass
MySQL带二进制的库表导出导入
Kubernetes notes (VI) kubernetes storage