【python】跳过验证直接登陆-把cookie导入excl表格然后调用
2021/6/6 20:28:02
本文主要是介绍【python】跳过验证直接登陆-把cookie导入excl表格然后调用,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
import time import xlwt import xlrd from common.comfig import local_config from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager driver = webdriver.Chrome(ChromeDriverManager().install()) driver.implicitly_wait(10) driver.get(local_config.URL) #写入表格,第一次运行后注释掉 # time.sleep(30) # workbook=xlwt.Workbook(encoding='utf-8') # worksheet=workbook.add_sheet('sheet1') # worksheet.write(0,0,'name') # worksheet.write(0,1,'value') # worksheet.write(0,2,'domain') # worksheet.write(0,3,'path') # i=1 # for cookie in driver.get_cookies(): # worksheet.write(i,0,cookie['name']) # worksheet.write(i,1,cookie['value']) # worksheet.write(i,2,cookie['domain']) # worksheet.write(i,3,cookie['path']) # i=i+1 # workbook.save('cookie.xlsx') #调用写入表格的cookie wb=xlrd.open_workbook('cookie.xlsx') sheel=wb.sheet_by_name('sheet1') for row in range(1,sheel.nrows): driver.add_cookie({'name':sheel.cell_value(row,0),'value':sheel.cell_value(row,1),'domain':sheel.cell_value(row,2),'path':sheel.cell_value(row,3)}) driver.refresh()
这篇关于【python】跳过验证直接登陆-把cookie导入excl表格然后调用的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-23使用python部署一个usdt合约,部署自己的usdt稳定币
- 2024-12-20Python编程入门指南
- 2024-12-20Python编程基础与进阶
- 2024-12-19Python基础编程教程
- 2024-12-19python 文件的后缀名是什么 怎么运行一个python文件?-icode9专业技术文章分享
- 2024-12-19使用python 把docx转为pdf文件有哪些方法?-icode9专业技术文章分享
- 2024-12-19python怎么更换换pip的源镜像?-icode9专业技术文章分享
- 2024-12-19Python资料:新手入门的全面指南
- 2024-12-19Python股票自动化交易实战入门教程
- 2024-12-19Python股票自动化交易入门教程