Files
F6--/F6系统常用脚本/材料信息修改规格型号.py
2026-01-30 11:28:35 +08:00

82 lines
3.0 KiB
Python

# -*- 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:\Users\admin\Desktop\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\新建XLS 工作表 (4).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/kzf6/partInfo/newPageList.do?page=view%2Fmaterial.html%23/info/edit/'+idMember+'&idOwnOrg=11240984669917170626&manageStatus=0'
# 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(
'//*[@id="material-content"]/form/div[5]/div[2]/div/div/div/input')
input_bos.send_keys(Keys.CONTROL, 'a')
input_bos.send_keys(Keys.BACK_SPACE)
input_bos.send_keys(receiveAmount)
time.sleep(0.2)
driver.find_element_by_xpath(
'//*[@id="material-content"]/div[1]/span[1]/button/span').click()
time.sleep(0.2)
endtime = datetime.datetime.now()
implement = (endtime - starttime).seconds
print(i, implement)
except:
print('失败')
continue