# -*- coding: utf-8 -*- from selenium import webdriver from time import sleep from openpyxl import workbook ,load_workbook ,Workbook import os ,time ,ytFuntion #1.3.2,加入等待時間 def sheet_date(): sheet["F" + str(i)].value = time.strftime("%y_%m_%d") #檢查日期 sheet["G" + str(i)].value = time.strftime("%H_%M_%S") #檢查時間 groupNumber = input("請輸入Web測試站點序列號:").strip() webDriver = webdriver.Chrome(executable_path='chromedriver.exe') test_web = ytFuntion.test_web(webDriver) wbAccount = load_workbook("主副域名對照表.xlsx") sheetAccount = wbAccount["Account"] # 獲取一張表 wb = load_workbook("檢查JS用.xlsx") sheet = wb["web"] # 獲取一張表 for i in range(1,len(sheetAccount["A"])+1): if str(sheetAccount["A" + str(i)].value).strip() == str(groupNumber): testWebUrl = str(sheetAccount["D" + str(i)].value).strip() sheet["A1"].value = testWebUrl webDriver.get(str(testWebUrl) + str(sheet["D2"].value).strip()) testSiteID = str(sheetAccount["G" + str(i)].value).strip() sheet["A2"].value = testSiteID account = str(sheetAccount["E" + str(i)].value).strip() #帳號
def sheet_date(): sheet["F" + str(i)].value = time.strftime("%y_%m_%d") #檢查日期 sheet["G" + str(i)].value = time.strftime("%H_%M_%S") #檢查時間 testdayFile = time.strftime("%y_%m_%d") testdayTime = time.strftime("%y_%m_%d_%H_%M_%S") if not os.path.exists(testdayFile): #先確認資料夾是否存在 os.makedirs(testdayFile) chrome_path = "D:\selenium_driver_chrome\chromedriver.exe" #webdriver放置資料夾 webDriver = webdriver.Chrome(chrome_path) test_web = ytFuntion.test_web(webDriver) wb = load_workbook("前台.xlsx") sheet = wb["web"] # 獲取一張表 testWebUrl = input("請輸入測試站點的url(Ex.http://winvip66.acgtest.com):") sheet["A1"].value = testWebUrl webDriver.get(str(testWebUrl) + str(sheet["D2"].value).strip()) print() for i in range(2, len(sheet["B"]) + 1): if i == 10: test_web.elementClick("亲,请登录", 3) test_web.elementSendKeys("input[tag=帐号]", 6, text="ytau") test_web.elementSendKeys("input[tag=密码]", 6, text="qwe123") test_web.elementClick("[class='mainColorBtn submitBtnBig ClickShade']",
submitCheck = False sheet_money["D"+str(len(sheet_money["B"]))].value = time.strftime("%y_%m_%d") #投注時間 sheet_money["E"+str(len(sheet_money["B"]))].value = time.strftime("%H_%M_%S") #投注時間 sheet_money["F"+str(len(sheet_money["B"]))].value = period[0] #投注期號 sheet_row = len(sheet_money["B"]) #投注金額填表 for k in range(len(period[1])): sheet_money.cell(row = sheet_row ,column = k + 7).value = period[1][k] wb_money.save(os.getcwd() + "\\" + str(testdayFile) + "\\" + str(testdayTime) + "_QQ分分彩" + "投注金額.xlsx") print("QQ分分彩全玩法投注") testNumber = input("測試站點序號:").strip() accountNumber = input("測試帳號序號:").strip() test_web = ytFuntion.test_web(webdriver.Chrome(executable_path='chromedriver.exe')) error = ["ERROR:"] wb = load_workbook("投注URL.xlsx") sheet = wb["QQ"] # 獲取一張表 wbAccount = load_workbook("前台帳號.xlsx") sheetAccount = wbAccount["帳號"] # 獲取一張表 for i in range(1,len(sheet["B"])+1): if str(sheet["B" + str(i)].value).strip() == str(testNumber): url = str(sheet["E" + str(i)].value).strip() webPageSelect = str(sheet["G" + str(i)].value).strip() if str(sheet["F" + str(i)].value).strip() == "None": waitSec = 600 else: waitSec = int(str(sheet["F" + str(i)].value).strip())
control_Sitting_url = str(sheet["D" + str(i)].value).strip() if str(sheet["B" + str(i)].value).strip() == "APKIOS": google_Driver_url = str(sheet["D" + str(i)].value).strip() if os.path.isfile("DEV-ipa%2Fapk 下載位置.xlsx"): #先確認檔案是否存在 os.remove("DEV-ipa%2Fapk 下載位置.xlsx") options = webdriver.ChromeOptions() prefs = { "profile.default_content_settings.popups": 0, "download.default_directory": os.getcwd() } options.add_experimental_option("prefs", prefs) control_Web = ytFuntion.test_web( webdriver.Chrome(executable_path='chromedriver.exe', chrome_options=options)) control_Web.webDriver.get(google_Driver_url) #目標網址 control_Web.elementSendKeys("identifierId", 1, text=google_Account_sitting) control_Web.elementClick( "div[id='identifierNext'] content[class='CwaK9'] span[class='RveJvd snByac']", 6) control_Web.elementSendKeys("input[type=password]", 6, text=google_Password_sitting) control_Web.elementClick( "div[id='passwordNext'] content[class='CwaK9'] span[class='RveJvd snByac']", 6)
if str(sheet["B" + str(i)].value).strip() == "總控": control_Url = str(sheet["D" + str(i)].value).strip() if str(sheet["B" + str(i)].value).strip() == "總控站點": control_Sitting_url = str(sheet["D" + str(i)].value).strip() if str(sheet["B" + str(i)].value).strip() == "APKIOS": google_Driver_url = str(sheet["D" + str(i)].value).strip() if os.path.isfile("DEV-ipa%2Fapk 下載位置.xlsx"): #先確認檔案是否存在 os.remove("DEV-ipa%2Fapk 下載位置.xlsx") options = webdriver.ChromeOptions() prefs = {"profile.default_content_settings.popups": 0, "download.default_directory": os.getcwd()} options.add_experimental_option("prefs", prefs) control_Web = ytFuntion.test_web(webdriver.Chrome(executable_path='chromedriver.exe', chrome_options=options)) control_Web.webDriver.get(google_Driver_url) #目標網址 control_Web.elementSendKeys("identifierId" ,1 ,text = google_Account_sitting) control_Web.elementClick("div[id='identifierNext'] content[class='CwaK9'] span[class='RveJvd snByac']" ,6) control_Web.elementSendKeys("input[type=password]" ,6 ,text = google_Password_sitting) control_Web.elementClick("div[id='passwordNext'] content[class='CwaK9'] span[class='RveJvd snByac']" ,6) sleep(5) if not os.path.isfile("DEV-ipa%2Fapk 下載位置.xlsx"): input("確認google有成功登入後,請按ENTER繼續") url_Number = " " error_Count = 0 error_Count_s = 0