fix: 修改逻辑

This commit is contained in:
chenwj113 2023-03-07 10:27:50 +08:00
parent 200a91c9f7
commit 7e7599757b
3 changed files with 108 additions and 67 deletions

View File

@ -20,10 +20,10 @@ try:
write("c113w927j", into="请输入6-12位数字或字母") write("c113w927j", into="请输入6-12位数字或字母")
click(Button("登 录")) click(Button("登 录"))
# 进入页面先点击关闭弹窗按钮 # 进入页面先点击关闭弹窗按钮
_topclose = S('div.layerimg_topclose') # _topclose = S('div.layerimg_topclose')
if _topclose.exists: # if _topclose.exists:
click(_topclose) # click(_topclose)
_close = S('//*[@id="vue2_el"]/div/div[10]/div/p') _close = S('p.close')
if _close.exists: if _close.exists:
click(_close) click(_close)
@ -54,7 +54,8 @@ try:
click(pls) click(pls)
# wait_until(Text('组选').exists) # wait_until(Text('组选').exists)
click(Text('组选')) click(Text('组选'))
result = ['039', '147', '057', '156', '138', '368', '269', '089', '458', '467'] # result = ['129', '156', '138', '237', '147']
result = ['346', '139', '247', '256', '049']
for index, item in enumerate(result): for index, item in enumerate(result):
if len(set(item)) == 3: if len(set(item)) == 3:
# 普通投注-> 取消组3 # 普通投注-> 取消组3
@ -87,9 +88,9 @@ try:
wait_until(Text("+继续添加").exists) wait_until(Text("+继续添加").exists)
click(Text("+继续添加")) click(Text("+继续添加"))
# # 设置倍数后,再点击一次下一步 # # 设置倍数后,再点击一次下一步
# plus = Text("+") plus = Text("+")
# for i in range(2): for i in range(1):
# click(plus) click(plus)
save = Text("保存") save = Text("保存")
wait_until(save.exists) wait_until(save.exists)
click(Text("保存")) click(Text("保存"))

14
pls.py
View File

@ -36,11 +36,15 @@ for i in sum_group6_dict.keys():
f2 = lambda number: len([i for i in number if int(i) %2 == 1]) != 0 f2 = lambda number: len([i for i in number if int(i) %2 == 1]) != 0
f3 = lambda number: True if max(map(int, number)) - min(map(int, number)) != 2 else False f3 = lambda number: True if max(map(int, number)) - min(map(int, number)) != 2 else False
f4 = lambda number: True if '3' not in number else False f4 = lambda number: True if '3' not in number else False
f5 = lambda number: True if 'a' not in number else False f5 = lambda number: True if '3' not in number else False
if i in [12, 17]: f6 = lambda number: True if len(set('387').difference(number)) == 2 else False
result = sum_group6_dict[i] + sum_group3_dict[i] if i in [11, 16, 17]:
print(i, list(filter(f1, result))) # result = sum_group6_dict[i] + sum_group3_dict[i]
# print(i, sum_group3_dict[i]) result = sum_group3_dict[i]
print(i, list(filter(f5, result)))
result = sum_group6_dict[i]
print(i, list(filter(f5, result)))
# 连号 # 连号
result = [] result = []

View File

@ -28,13 +28,15 @@ class Chrome(object):
write("c113w927j", into="请输入6-12位数字或字母") write("c113w927j", into="请输入6-12位数字或字母")
click(Button("登 录")) click(Button("登 录"))
# 进入页面先点击关闭弹窗按钮 # 进入页面先点击关闭弹窗按钮
_close = S('//*[@id="vue2_el"]/div/div[10]/div/p') # _close = S('//*[@id="vue2_el"]/div/div[10]/div/p')
click(_close) # click(_close)
_close = S('p.close')
if _close.exists:
click(_close)
return self return self
def __exit__(self, type, value, trace): def __exit__(self, type, value, trace):
kill_browser() kill_browser()
print("type: " + type + ", value = " + value)
def balance(self): def balance(self):
@ -51,64 +53,98 @@ class Chrome(object):
back = S('#vue2_el > header > div.back > a') back = S('#vue2_el > header > div.back > a')
click(back) click(back)
def pls(self, result=[]):
def pls(self, result=[], multiple=1, is_group=True, save_result=True):
# 点击排列三 # 点击排列三
_pls = S('p.lottname.p3') _pls = S('p.lottname.p3')
wait_until(_pls.exists) wait_until(_pls.exists)
click(_pls) click(_pls)
zx = Text('组选') if is_group: # 组选
if not zx.exists: zx = Text('组选')
wait_until(zx.exists) if not zx.exists:
click(zx) wait_until(zx.exists)
# 普通投注-> 取消组3 click(zx)
# result = ['258', '357', '069', '168', '078', '267', '159', '339', '177', '366'] # 普通投注-> 取消组3
for index, item in enumerate(result): # result = ['258', '357', '069', '168', '078', '267', '159', '339', '177', '366']
if len(set(item)) == 3: for index, item in enumerate(result):
click(Text('普通投注')) if len(set(item)) == 3:
for i in item: click(Text('普通投注'))
ball_line = S(f'//*[@id="body"]/section/div[3]/div[2]/ul/li[{int(i) + 1}]/p[1]') for i in item:
if ball_line.exists: ball_line = S(f'//*[@id="body"]/section/div[3]/div[2]/ul/li[{int(i) + 1}]/p[1]')
print(ball_line.web_element.text) if ball_line.exists:
click(ball_line) print(ball_line.web_element.text)
else: click(ball_line)
print(f"{i}不存在") else:
group3 = Text("组3") print(f"{i}不存在")
if not group3.exists: wait_until(Text("组3").exists)
wait_until(group3.exists) click(Text("组3"))
click(group3)
else:
click(Text('组3单式'))
if item[0] == item[1]:
double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[0]) + 1}]/p')
single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[2]) + 1}]/p')
else: else:
double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[2]) + 1}]/p') click(Text('组3单式'))
single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[0]) + 1}]/p') if item[0] == item[1]:
click(double_ball) double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[0]) + 1}]/p')
click(single_ball) single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[2]) + 1}]/p')
print(f"{index}: {item}") else:
next_step = Text("下一步") double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[2]) + 1}]/p')
if not next_step.exists: single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[0]) + 1}]/p')
wait_until(next_step.exists) click(double_ball)
click(next_step) click(single_ball)
if index + 1 != len(result): print(f"对子号:{double_ball.web_element.text}")
wait_until(Text("+继续添加").exists) print(f"非对子号:{single_ball.web_element.text}")
click(Text("+继续添加")) print(f"{index}: {item}")
#div.mult_numkeyboard > ul > li:nth-child(1) > p next_step = Text("下一步")
#div.mult_numkeyboard > ul > li:nth-child(2) > p if not next_step.exists:
#div.mult_numkeyboard > ul > li:nth-child(11) > p wait_until(next_step.exists)
save = Text("保存") click(next_step)
if not save.exists: if index + 1 != len(result):
wait_until(save.exists) wait_until(Text("+继续添加").exists)
click(save) click(Text("+继续添加"))
else:
for index, item in enumerate(result):
hundred_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[0]) + 1}]/p')
if hundred_ball.exists:
click(hundred_ball)
ten_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[1]) + 1}]/p')
if ten_ball.exists:
click(ten_ball)
single_ball = S(f'//*[@id="body"]/section/div[3]/div[3]/div[2]/ul/li[{int(item[2]) + 1}]/p')
if single_ball.exists:
click(single_ball)
next_step = Text("下一步")
if not next_step.exists:
wait_until(next_step.exists)
click(next_step)
if index + 1 != len(result):
wait_until(Text("+继续添加").exists)
click(Text("+继续添加"))
print(f"直选, index:{index}, item:{item}")
if multiple > 0:
for i in range(multiple - 1):
click(Text("+"))
if save_result: # 是否保存
save = Text("保存")
if not save.exists:
wait_until(save.exists)
click(save)
else: # 不保存直接进行下一步
second_next_step = Text("下一步")
if not second_next_step.exists:
wait_until(second_next_step.exists)
click(second_next_step)
confirm = Text("确认")
if not confirm.exists:
wait_until(confirm.exists)
click(confirm)
# 后退
back_1 = S('a.backlink') back_1 = S('a.backlink')
if not back_1.exists: if not back_1.exists:
wait_until(back_1.exists) wait_until(back_1.exists)
click(back_1) click(back_1)
back_2 = S('div.back') if save_result: # 进入保存页面还需要再后退一步
if not back_2.exists: back_2 = S('div.back')
wait_until(back_2.exists) if not back_2.exists:
click(back_2) wait_until(back_2.exists)
click(back_2)
def zuqiu(self): def zuqiu(self):
# 点击竞彩足球 # 点击竞彩足球
@ -159,7 +195,7 @@ class Chrome(object):
click(back_1) click(back_1)
with Chrome(headless=False) as chrome: with Chrome() as chrome:
chrome.balance() chrome.balance()
result = ['078', '348', '456', '069', '168', '177', '339', '366', '447', '678', '579', '489', '399', '669', '588'] result = ['189', '279', '269', '278', '179', '178', '259', '268', '079', '169']
chrome.pls(result = result) chrome.pls(result = result)