自动化下注
Last updated
Last updated
# -*- coding: UTF-8 -*-
from selenium import webdriver
import time
import ddddocr
ben = webdriver.Chrome()
get_html = "zh-h5.kaola666.top.html"
f = open(get_html, 'wb')
url = "https://zh-h5.kaola666.top/login?redirect=/mine"
print('切换全屏')
#ben.maximize_window()
ben.get(url)
ben.title
print('保存 验证码')
png = ben.find_element_by_xpath('//*[@id="app"]/div[3]/div[2]/form/div[3]/div[2]/div/div/div/img')
png.screenshot("zh-h5.kaola666.top.验证码.png")
print('识别 验证码')
ocr = ddddocr.DdddOcr()
with open('zh-h5.kaola666.top.验证码.png', 'rb') as f:
img_bytes = f.read()
imgres = ocr.classification(img_bytes)
print(imgres)
print('点击 账号进行输入')
ben.find_element_by_xpath('//*[@id="van-field-1-input"]').send_keys("benniao")
print('点击 密码进行输入')
ben.find_element_by_xpath('//*[@id="van-field-2-input"]').send_keys("123456")
print('点击 验证码进行输入')
ben.find_element_by_xpath('//*[@id="van-field-3-input"]').send_keys(imgres)
print('点击 登录按钮')
ben.find_element_by_xpath('//*[@id="app"]/div[3]/div[2]/form/div[5]/button[1]').click()
print('点击 下注')
time.sleep(1)
ben.find_element_by_xpath('//*[@id="app"]/div[3]/div[3]/div[1]/div[2]/div/div[1]/p').click()
print('点击 普通仓')
time.sleep(1)
ben.find_element_by_xpath('//*[@id="app"]/div[3]/div[2]/div[1]/div[1]/span[1]').click()
print('开始下注')
time.sleep(1)
ben.find_element_by_xpath('//*[@id="van-field-4-input"]').send_keys("100")
ben.find_element_by_xpath('//*[@id="van-field-6-input"]').send_keys("101")
ben.find_element_by_xpath('//*[@id="van-field-8-input"]').send_keys("102")
ben.find_element_by_xpath('//*[@id="van-field-10-input"]').send_keys("103")
print('点击 购买')
time.sleep(1)
ben.find_element_by_xpath('//*[@id="app"]/div[3]/div[2]/div[2]/div/div[2]').click()
time.sleep(1)
ben.find_element_by_xpath('//*[@id="app"]/div[3]/div[3]/div/div[5]/div[2]').click()
time.sleep(1)
print('返回 交易大廳')
time.sleep(1)
ben.find_element_by_xpath('//*[@id="app"]/div[1]/div/div[1]/i').click()
time.sleep(1)
print('返回 主界面')
time.sleep(1)
ben.find_element_by_xpath('//*[@id="app"]/div[1]/div/div[1]/i').click()
time.sleep(1)
print('点击 我的 ')
time.sleep(1)
ben.find_element_by_xpath('//*[@id="app"]/div[4]/div[4]/p').click()
time.sleep(1)
print('点击 交易记录')
time.sleep(1)
ben.find_element_by_xpath('//*[@id="app"]/div[3]/div[2]/div[2]/div[1]/div/span').click()
time.sleep(1)
#ben.quit()
#print('关闭浏览器')