This commit is contained in:
2026-01-30 11:28:35 +08:00
commit f1831c31b4
399 changed files with 860978 additions and 0 deletions
@@ -0,0 +1,91 @@
# -*- coding:UTF-8 -*-
# 功能:F6系统页面会员卡退卡操作
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver import ActionChains
import time
import xlrd
import xlwt
import re
from xlutils.copy import copy
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
import datetime
# 获取会员卡基础信息
name = '15888265981'
password = 'F6123456'
option_chrome = webdriver.ChromeOptions()
option_chrome.add_argument('--headless')
http = 'https://m.f6car.cn/'
# 进入链接获取json
# driver = webdriver.Chrome(chrome_options=option_chrome)
driver = webdriver.Chrome(executable_path=r"C:\迅雷下载\python 暂存文件\Python\chromedriver.exe")
driver.maximize_window()
driver.implicitly_wait(2)
driver.get(http)
driver.find_element_by_xpath('//*[@id="pane-username"]/form/div[1]/div/div/input').send_keys(name)
driver.find_element_by_xpath('//*[@id="pane-username"]/form/div[2]/div/div[1]/input').send_keys(password)
driver.find_element_by_xpath('//*[@id="pane-username"]/form/div[3]/div/button/span').click()
time.sleep(15) # 预设时间
# 新建一个excel文件
file = xlwt.Workbook() # 注意这里的Workbook首字母是大写,无语吧
# 新建sheet
table = file.add_sheet('sheet name', cell_overwrite_ok=True)
if 1 == 1:
he = 0
hen = 0
heng = 0
hang = 0
len = 0
# 获取所有内容
# 打开excel文件
data = xlrd.open_workbook(r'C:\Users\admin\Desktop\Python脚本\图形界面自动化脚本\F6系统常用脚本\Excel通用存储位置.xls')
print(data)
table = data.sheet_by_index(0) # 通过索引顺序获取
h = table.nrows
l = table.ncols
print(u"表数据的行数为%s,列数为%s" % (h, l))
# 获取卡项目
for i in range(0, h):
try:
starttime = datetime.datetime.now()
idMember = table.cell(i, 0).value # 按行读取数据
receiveAmount = table.cell(i, 1).value # 按行读取数据
https = 'https://yunxiu.f6car.cn/cayenne/view/index.html#/cayenne-goods/info/list/local'
# http = 'https://yunxiu-trial.f6car.cn/kzf6/payment/toGathering.do?idSourceBill=' + idMember + '&billType=TKD'
# 进入链接获取json
driver.get(https)
# 传值转换
#driver.switch_to.frame('weixin-page-iframe')
time.sleep(0.2)
# driver.find_element_by_xpath(
# '//*[@id="app"]/div[2]/div[2]/div/section[2]/div[2]/div[2]/div[3]/div/div/input').send_keys(onename)
input_bos = driver.find_element_by_xpath(
'/html/body/div[1]/div[1]/div[3]/div[2]/div/div/div/div/div/div[2]/div[3]/div[1]/div[1]/div[1]/div[1]/input')
input_bos.send_keys(Keys.CONTROL, 'a')
input_bos.send_keys(Keys.BACK_SPACE)
input_bos.send_keys(idMember)
time.sleep(0.2)
driver.find_element_by_xpath(
'/html/body/div[1]/div[1]/div[3]/div[2]/div/div/div/div/div/div[2]/div[3]/div[1]/div[1]/div[1]/div[1]/div/button').click()
time.sleep(0.5)
driver.find_element_by_xpath(
'//*[@id="table"]/div[1]/div[3]/table/tbody/tr/td[13]/div/span[2]').click()
time.sleep(0.5)
driver.find_element_by_xpath(
'/html/body/div[3]/div/div[2]/div/div[1]/form/div[3]/div[3]/div/div/div/div/form/div/div[2]/div/div/input').send_keys(receiveAmount)
time.sleep(0.5)
driver.find_element_by_xpath(
'/html/body/div[3]/div/div[2]/div/div[2]/button[1]/span').click()
time.sleep(0.5)
endtime = datetime.datetime.now()
implement = (endtime - starttime).seconds
print(i, idMember,receiveAmount,implement)
except:
print('失败')
continue