diff --git a/auto_v2.py b/auto_v2.py index 4016b41..5de081f 100644 --- a/auto_v2.py +++ b/auto_v2.py @@ -20,10 +20,10 @@ try: write("c113w927j", into="请输入6-12位数字或字母") click(Button("登 录")) # 进入页面先点击关闭弹窗按钮 - _topclose = S('div.layerimg_topclose') - if _topclose.exists: - click(_topclose) - _close = S('//*[@id="vue2_el"]/div/div[10]/div/p') + # _topclose = S('div.layerimg_topclose') + # if _topclose.exists: + # click(_topclose) + _close = S('p.close') if _close.exists: click(_close) @@ -54,7 +54,8 @@ try: click(pls) # wait_until(Text('组选').exists) 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): if len(set(item)) == 3: # 普通投注-> 取消组3 @@ -87,9 +88,9 @@ try: wait_until(Text("+继续添加").exists) click(Text("+继续添加")) # # 设置倍数后,再点击一次下一步 - # plus = Text("+") - # for i in range(2): - # click(plus) + plus = Text("+") + for i in range(1): + click(plus) save = Text("保存") wait_until(save.exists) click(Text("保存")) diff --git a/pls.py b/pls.py index 1e61a8e..e7754f2 100644 --- a/pls.py +++ b/pls.py @@ -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 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 - f5 = lambda number: True if 'a' not in number else False - if i in [12, 17]: - result = sum_group6_dict[i] + sum_group3_dict[i] - print(i, list(filter(f1, result))) - # print(i, sum_group3_dict[i]) + f5 = lambda number: True if '3' not in number else False + f6 = lambda number: True if len(set('387').difference(number)) == 2 else False + if i in [11, 16, 17]: + # result = sum_group6_dict[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 = [] diff --git a/youdian.py b/youdian.py index e659180..db24fe2 100644 --- a/youdian.py +++ b/youdian.py @@ -28,13 +28,15 @@ class Chrome(object): write("c113w927j", into="请输入6-12位数字或字母") click(Button("登 录")) # 进入页面先点击关闭弹窗按钮 - _close = S('//*[@id="vue2_el"]/div/div[10]/div/p') - click(_close) + # _close = S('//*[@id="vue2_el"]/div/div[10]/div/p') + # click(_close) + _close = S('p.close') + if _close.exists: + click(_close) return self def __exit__(self, type, value, trace): kill_browser() - print("type: " + type + ", value = " + value) def balance(self): @@ -51,64 +53,98 @@ class Chrome(object): back = S('#vue2_el > header > div.back > a') click(back) - def pls(self, result=[]): + + def pls(self, result=[], multiple=1, is_group=True, save_result=True): # 点击排列三 _pls = S('p.lottname.p3') wait_until(_pls.exists) click(_pls) - zx = Text('组选') - if not zx.exists: - wait_until(zx.exists) - click(zx) - # 普通投注-> 取消组3 - # result = ['258', '357', '069', '168', '078', '267', '159', '339', '177', '366'] - for index, item in enumerate(result): - if len(set(item)) == 3: - click(Text('普通投注')) - for i in item: - ball_line = S(f'//*[@id="body"]/section/div[3]/div[2]/ul/li[{int(i) + 1}]/p[1]') - if ball_line.exists: - print(ball_line.web_element.text) - click(ball_line) - else: - print(f"{i}不存在") - group3 = Text("组3") - if not group3.exists: - wait_until(group3.exists) - 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') + if is_group: # 组选 + zx = Text('组选') + if not zx.exists: + wait_until(zx.exists) + click(zx) + # 普通投注-> 取消组3 + # result = ['258', '357', '069', '168', '078', '267', '159', '339', '177', '366'] + for index, item in enumerate(result): + if len(set(item)) == 3: + click(Text('普通投注')) + for i in item: + ball_line = S(f'//*[@id="body"]/section/div[3]/div[2]/ul/li[{int(i) + 1}]/p[1]') + if ball_line.exists: + print(ball_line.web_element.text) + click(ball_line) + else: + print(f"{i}不存在") + wait_until(Text("组3").exists) + click(Text("组3")) else: - double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[2]) + 1}]/p') - single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[0]) + 1}]/p') - click(double_ball) - click(single_ball) - print(f"{index}: {item}") - 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("+继续添加")) - #div.mult_numkeyboard > ul > li:nth-child(1) > p - #div.mult_numkeyboard > ul > li:nth-child(2) > p - #div.mult_numkeyboard > ul > li:nth-child(11) > p - save = Text("保存") - if not save.exists: - wait_until(save.exists) - click(save) + 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: + double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[2]) + 1}]/p') + single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[0]) + 1}]/p') + click(double_ball) + click(single_ball) + print(f"对子号:{double_ball.web_element.text}") + print(f"非对子号:{single_ball.web_element.text}") + print(f"{index}: {item}") + 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("+继续添加")) + 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') if not back_1.exists: wait_until(back_1.exists) click(back_1) - back_2 = S('div.back') - if not back_2.exists: - wait_until(back_2.exists) - click(back_2) + if save_result: # 进入保存页面还需要再后退一步 + back_2 = S('div.back') + if not back_2.exists: + wait_until(back_2.exists) + click(back_2) + def zuqiu(self): # 点击竞彩足球 @@ -159,7 +195,7 @@ class Chrome(object): click(back_1) -with Chrome(headless=False) as chrome: +with Chrome() as chrome: 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) \ No newline at end of file