基于Selenium+Python实现自动解数独,秒变最强大脑

news/2024/10/17 23:26:07/

前言

在本文中,我将向大家介绍如何使用Python编写一个数独脚本,并实现模拟完成数独游戏的脚本。数独是一种经典的逻辑游戏,它可以帮助我们锻炼逻辑思维能力。通过编写数独脚本,我们可以使用Python语言解决数独问题,从而更好地理解编程和算法。

效果

 

环境使用

  • python 3.9
  • pycharm

模块使用

  • selenium

模块介绍

  • requests

        requests是一个很实用的Python HTTP客户端库,爬虫和测试服务器响应数据时经常会用到,requests是Python语言的第三方的库,专门用于发送HTTP请求,使用起来比urllib简洁很多。

  • parsel

        parsel是一个python的第三方库,相当于css选择器+xpath+re。

parsel由scrapy团队开发,是将scrapy中的parsel独立抽取出来的,可以轻松解析html,xml内容,获取需要的数据。

相比于BeautifulSoup,xpath,parsel效率更高,使用更简单。

  • re

        re模块是python独有的匹配字符串的模块,该模块中提供的很多功能是基于正则表达式实现的,而正则表达式是对字符串进行模糊匹配,提取自己需要的字符串部分,他对所有的语言都通用。

  • os

        os 就是 “operating system” 的缩写,顾名思义,os模块提供的就是各种 Python 程序与操作系统进行交互的接口。通过使用 os 模块,一方面可以方便地与操作系统进行交互,另一方面也可以极大增强代码的可移植性。

  • csv

        它是一种文件格式,一般也被叫做逗号分隔值文件,可以使用 Excel 软件或者文本文档打开 。其中数据字段用半角逗号间隔(也可以使用其它字符),使用 Excel 打开时,逗号会被转换为分隔符。csv 文件是以纯文本形式存储了表格数据,并且在兼容各个操作系统。

模块安装问题:

  • 如果安装python第三方模块:

win + R 输入 cmd 点击确定, 输入安装命令 pip install 模块名 (pip install requests) 回车

在pycharm中点击Terminal(终端) 输入安装命令

  • 安装失败原因:

  • 失败一: pip 不是内部命令

                解决方法: 设置环境变量

  • 失败二: 出现大量报红 (read time out)

                解决方法: 因为是网络链接超时, 需要切换镜像源

   

    清华:https://pypi.tuna.tsinghua.edu.cn/simple阿里云:https://mirrors.aliyun.com/pypi/simple/中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/华中理工大学:https://pypi.hustunique.com/山东理工大学:https://pypi.sdutlinux.org/豆瓣:https://pypi.douban.com/simple/例如:pip3 install -i https://pypi.doubanio.com/simple/ 模块名
  • 失败三: cmd里面显示已经安装过了, 或者安装成功了, 但是在pycharm里面还是无法导入

                解决方法: 可能安装了多个python版本 (anaconda 或者 python 安装一个即可) 卸载一个就好,或者你pycharm里面python解释器没有设置好。

代码实现

这个是不是很厉害,实际上很简单,接下来,我一步一步教大家如何完成这样的脚本。

获取数独数据

我们首先进入游戏的网页,把网页中的九宫格的数字获取下来。在线数独游戏官网。

接下来,我们使用开发者工具,获取这些数字的CSS或者XPath,因为我们要用selenium获取下来,这里我们要注意,我们这里还要注意数字的顺序,否则,会影响我们后面解数独。我们先看看网页源代码吧。

我们会发现,每九个数放在了一个class="sz?"里面,其中每个数都有自己对应的坐标,比如说,第一行第一列的数就是c_0_0,第一个0表示列数,第二个0表示行数,这个对我们后期代码的编写有很大的帮助。下面,我们先写一个获取第一行第一列的数的代码。

    c_0_0 = driver.find_element(By.CSS_SELECTOR, '#c_0_0').textif c_0_0 == '':c_0_0 = 0list1.append(c_0_0)else:list1.append(int(c_0_0))

这段代码使用了Selenium库中的find_element方法来查找一个元素,并获取该元素的文本。然后,它检查这个文本是否为空,如果为空,则将空文本转换为整数0,并将其添加到一个名为list1的列表中。如果文本不为空,则将其转换为整数,并添加到list1列表中。至于为什么要放到列表里面呢,是因为后面我们解数独要要用到,其他数的代码都一样,我这里就直接展示了。

list1 = []# (0,0)c_0_0 = driver.find_element(By.CSS_SELECTOR, '#c_0_0').textif c_0_0 == '':c_0_0 = 0list1.append(c_0_0)else:list1.append(int(c_0_0))# (1,0)c_1_0 = driver.find_element(By.CSS_SELECTOR, '#c_1_0').textif c_1_0 == '':c_1_0 = 0list1.append(c_1_0)else:list1.append(int(c_1_0))# (2,0)c_2_0 = driver.find_element(By.CSS_SELECTOR, '#c_2_0').textif c_2_0 == '':c_2_0 = 0list1.append(c_2_0)else:list1.append(int(c_2_0))# (3,0)c_3_0 = driver.find_element(By.CSS_SELECTOR, '#c_3_0').textif c_3_0 == '':c_3_0 = 0list1.append(c_3_0)else:list1.append(int(c_3_0))# (4,0)c_4_0 = driver.find_element(By.CSS_SELECTOR, '#c_4_0').textif c_4_0 == '':c_4_0 = 0list1.append(c_4_0)else:list1.append(int(c_4_0))# (5,0)c_5_0 = driver.find_element(By.CSS_SELECTOR, '#c_5_0').textif c_5_0 == '':c_5_0 = 0list1.append(c_5_0)else:list1.append(int(c_5_0))# (6,0)c_6_0 = driver.find_element(By.CSS_SELECTOR, '#c_6_0').textif c_6_0 == '':c_6_0 = 0list1.append(c_6_0)else:list1.append(int(c_6_0))# (7,0)c_7_0 = driver.find_element(By.CSS_SELECTOR, '#c_7_0').textif c_7_0 == '':c_7_0 = 0list1.append(c_7_0)else:list1.append(int(c_7_0))# (8,0)c_8_0 = driver.find_element(By.CSS_SELECTOR, '#c_8_0').textif c_8_0 == '':c_8_0 = 0list1.append(c_8_0)else:list1.append(int(c_8_0))list2 = []# (0,1)c_0_1 = driver.find_element(By.CSS_SELECTOR, '#c_0_1').textif c_0_1 == '':c_0_1 = 0list2.append(c_0_1)else:list2.append(int(c_0_1))# (1,1)c_1_1 = driver.find_element(By.CSS_SELECTOR, '#c_1_1').textif c_1_1 == '':c_1_1 = 0list2.append(c_1_1)else:list2.append(int(c_1_1))# (2,1)c_2_1 = driver.find_element(By.CSS_SELECTOR, '#c_2_1').textif c_2_1 == '':c_2_1 = 0list2.append(c_2_1)else:list2.append(int(c_2_1))# (3,1)c_3_1 = driver.find_element(By.CSS_SELECTOR, '#c_3_1').textif c_3_1 == '':c_3_1 = 0list2.append(c_3_1)else:list2.append(int(c_3_1))# (4,1)c_4_1 = driver.find_element(By.CSS_SELECTOR, '#c_4_1').textif c_4_1 == '':c_4_1 = 0list2.append(c_4_1)else:list2.append(int(c_4_1))# (5,1)c_5_1 = driver.find_element(By.CSS_SELECTOR, '#c_5_1').textif c_5_1 == '':c_5_1 = 0list2.append(c_5_1)else:list2.append(int(c_5_1))# (6,1)c_6_1 = driver.find_element(By.CSS_SELECTOR, '#c_6_1').textif c_6_1 == '':c_6_1 = 0list2.append(c_6_1)else:list2.append(int(c_6_1))# (7,1)c_7_1 = driver.find_element(By.CSS_SELECTOR, '#c_7_1').textif c_7_1 == '':c_7_1 = 0list2.append(c_7_1)else:list2.append(int(c_7_1))# (8,1)c_8_1 = driver.find_element(By.CSS_SELECTOR, '#c_8_1').textif c_8_1 == '':c_8_1 = 0list2.append(c_8_1)else:list2.append(int(c_8_1))list3 = []# (0,2)c_0_2 = driver.find_element(By.CSS_SELECTOR, '#c_0_2').textif c_0_2 == '':c_0_2 = 0list3.append(c_0_2)else:list3.append(int(c_0_2))# (1,2)c_1_2 = driver.find_element(By.CSS_SELECTOR, '#c_1_2').textif c_1_2 == '':c_1_2 = 0list3.append(c_1_2)else:list3.append(int(c_1_2))# (2,2)c_2_2 = driver.find_element(By.CSS_SELECTOR, '#c_2_2').textif c_2_2 == '':c_2_2 = 0list3.append(c_2_2)else:list3.append(int(c_2_2))# (3,2)c_3_2 = driver.find_element(By.CSS_SELECTOR, '#c_3_2').textif c_3_2 == '':c_3_2 = 0list3.append(c_3_2)else:list3.append(int(c_3_2))# (4,2)c_4_2 = driver.find_element(By.CSS_SELECTOR, '#c_4_2').textif c_4_2 == '':c_4_2 = 0list3.append(c_4_2)else:list3.append(int(c_4_2))# (5,2)c_5_2 = driver.find_element(By.CSS_SELECTOR, '#c_5_2').textif c_5_2 == '':c_5_2 = 0list3.append(c_5_2)else:list3.append(int(c_5_2))# (6,2)c_6_2 = driver.find_element(By.CSS_SELECTOR, '#c_6_2').textif c_6_2 == '':c_6_2 = 0list3.append(c_6_2)else:list3.append(int(c_6_2))# (7,2)c_7_2 = driver.find_element(By.CSS_SELECTOR, '#c_7_2').textif c_7_2 == '':c_7_2 = 0list3.append(c_7_2)else:list3.append(int(c_7_2))# (8,2)c_8_2 = driver.find_element(By.CSS_SELECTOR, '#c_8_2').textif c_8_2 == '':c_8_2 = 0list3.append(c_8_2)else:list3.append(int(c_8_2))list4 = []# (0,3)c_0_3 = driver.find_element(By.CSS_SELECTOR, '#c_0_3').textif c_0_3 == '':c_0_3 = 0list4.append(c_0_3)else:list4.append(int(c_0_3))# (1,3)c_1_3 = driver.find_element(By.CSS_SELECTOR, '#c_1_3').textif c_1_3 == '':c_1_3 = 0list4.append(c_1_3)else:list4.append(int(c_1_3))# (2,3)c_2_3 = driver.find_element(By.CSS_SELECTOR, '#c_2_3').textif c_2_3 == '':c_2_3 = 0list4.append(c_2_3)else:list4.append(int(c_2_3))# (3,3)c_3_3 = driver.find_element(By.CSS_SELECTOR, '#c_3_3').textif c_3_3 == '':c_3_3 = 0list4.append(c_3_3)else:list4.append(int(c_3_3))# (4,3)c_4_3 = driver.find_element(By.CSS_SELECTOR, '#c_4_3').textif c_4_3 == '':c_4_3 = 0list4.append(c_4_3)else:list4.append(int(c_4_3))# (5,3)c_5_3 = driver.find_element(By.CSS_SELECTOR, '#c_5_3').textif c_5_3 == '':c_5_3 = 0list4.append(c_5_3)else:list4.append(int(c_5_3))# (6,3)c_6_3 = driver.find_element(By.CSS_SELECTOR, '#c_6_3').textif c_6_3 == '':c_6_3 = 0list4.append(c_6_3)else:list4.append(int(c_6_3))# (7,3)c_7_3 = driver.find_element(By.CSS_SELECTOR, '#c_7_3').textif c_7_3 == '':c_7_3 = 0list4.append(c_7_3)else:list4.append(int(c_7_3))# (8,3)c_8_3 = driver.find_element(By.CSS_SELECTOR, '#c_8_3').textif c_8_3 == '':c_8_3 = 0list4.append(c_8_3)else:list4.append(int(c_8_3))list5 = []# (0,4)c_0_4 = driver.find_element(By.CSS_SELECTOR, '#c_0_4').textif c_0_4 == '':c_0_4 = 0list5.append(c_0_4)else:list5.append(int(c_0_4))# (1,4)c_1_4 = driver.find_element(By.CSS_SELECTOR, '#c_1_4').textif c_1_4 == '':c_1_4 = 0list5.append(c_1_4)else:list5.append(int(c_1_4))# (2,4)c_2_4 = driver.find_element(By.CSS_SELECTOR, '#c_2_4').textif c_2_4 == '':c_2_4 = 0list5.append(c_2_4)else:list5.append(int(c_2_4))# (3,4)c_3_4 = driver.find_element(By.CSS_SELECTOR, '#c_3_4').textif c_3_4 == '':c_3_4 = 0list5.append(c_3_4)else:list5.append(int(c_3_4))# (4,4)c_4_4 = driver.find_element(By.CSS_SELECTOR, '#c_4_4').textif c_4_4 == '':c_4_4 = 0list5.append(c_4_4)else:list5.append(int(c_4_4))# (5,4)c_5_4 = driver.find_element(By.CSS_SELECTOR, '#c_5_4').textif c_5_4 == '':c_5_4 = 0list5.append(c_5_4)else:list5.append(int(c_5_4))# (6,4)c_6_4 = driver.find_element(By.CSS_SELECTOR, '#c_6_4').textif c_6_4 == '':c_6_4 = 0list5.append(c_6_4)else:list5.append(int(c_6_4))# (7,4)c_7_4 = driver.find_element(By.CSS_SELECTOR, '#c_7_4').textif c_7_4 == '':c_7_4 = 0list5.append(c_7_4)else:list5.append(int(c_7_4))# (8,4)c_8_4 = driver.find_element(By.CSS_SELECTOR, '#c_8_4').textif c_8_4 == '':c_8_4 = 0list5.append(c_8_4)else:list5.append(int(c_8_4))list6 = []# (0,5)c_0_5 = driver.find_element(By.CSS_SELECTOR, '#c_0_5').textif c_0_5 == '':c_0_5 = 0list6.append(c_0_5)else:list6.append(int(c_0_5))# (1,5)c_1_5 = driver.find_element(By.CSS_SELECTOR, '#c_1_5').textif c_1_5 == '':c_1_5 = 0list6.append(c_1_5)else:list6.append(int(c_1_5))# (2,5)c_2_5 = driver.find_element(By.CSS_SELECTOR, '#c_2_5').textif c_2_5 == '':c_2_5 = 0list6.append(c_2_5)else:list6.append(int(c_2_5))# (3,5)c_3_5 = driver.find_element(By.CSS_SELECTOR, '#c_3_5').textif c_3_5 == '':c_3_5 = 0list6.append(c_3_5)else:list6.append(int(c_3_5))# (4,5)c_4_5 = driver.find_element(By.CSS_SELECTOR, '#c_4_5').textif c_4_5 == '':c_4_5 = 0list6.append(c_4_5)else:list6.append(int(c_4_5))# (5,5)c_5_5 = driver.find_element(By.CSS_SELECTOR, '#c_5_5').textif c_5_5 == '':c_5_5 = 0list6.append(c_5_5)else:list6.append(int(c_5_5))# (6,5)c_6_5 = driver.find_element(By.CSS_SELECTOR, '#c_6_5').textif c_6_5 == '':c_6_5 = 0list6.append(c_6_5)else:list6.append(int(c_6_5))# (7,5)c_7_5 = driver.find_element(By.CSS_SELECTOR, '#c_7_5').textif c_7_5 == '':c_7_5 = 0list6.append(c_7_5)else:list6.append(int(c_7_5))# (8,5)c_8_5 = driver.find_element(By.CSS_SELECTOR, '#c_8_5').textif c_8_5 == '':c_8_5 = 0list6.append(c_8_5)else:list6.append(int(c_8_5))list7 = []# (0,6)c_0_6 = driver.find_element(By.CSS_SELECTOR, '#c_0_6').textif c_0_6 == '':c_0_6 = 0list7.append(c_0_6)else:list7.append(int(c_0_6))# (1,6)c_1_6 = driver.find_element(By.CSS_SELECTOR, '#c_1_6').textif c_1_6 == '':c_1_6 = 0list7.append(c_1_6)else:list7.append(int(c_1_6))# (2,6)c_2_6 = driver.find_element(By.CSS_SELECTOR, '#c_2_6').textif c_2_6 == '':c_2_6 = 0list7.append(c_2_6)else:list7.append(int(c_2_6))# (3,6)c_3_6 = driver.find_element(By.CSS_SELECTOR, '#c_3_6').textif c_3_6 == '':c_3_6 = 0list7.append(c_3_6)else:list7.append(int(c_3_6))# (4,6)c_4_6 = driver.find_element(By.CSS_SELECTOR, '#c_4_6').textif c_4_6 == '':c_4_6 = 0list7.append(c_4_6)else:list7.append(int(c_4_6))# (5,6)c_5_6 = driver.find_element(By.CSS_SELECTOR, '#c_5_6').textif c_5_6 == '':c_5_6 = 0list7.append(c_5_6)else:list7.append(int(c_5_6))# (6,6)c_6_6 = driver.find_element(By.CSS_SELECTOR, '#c_6_6').textif c_6_6 == '':c_6_6 = 0list7.append(c_6_6)else:list7.append(int(c_6_6))# (7,6)c_7_6 = driver.find_element(By.CSS_SELECTOR, '#c_7_6').textif c_7_6 == '':c_7_6 = 0list7.append(c_7_6)else:list7.append(int(c_7_6))# (8,6)c_8_6 = driver.find_element(By.CSS_SELECTOR, '#c_8_6').textif c_8_6 == '':c_8_6 = 0list7.append(c_8_6)else:list7.append(int(c_8_6))list8 = []# (0,7)c_0_7 = driver.find_element(By.CSS_SELECTOR, '#c_0_7').textif c_0_7 == '':c_0_7 = 0list8.append(c_0_7)else:list8.append(int(c_0_7))# (1,7)c_1_7 = driver.find_element(By.CSS_SELECTOR, '#c_1_7').textif c_1_7 == '':c_1_7 = 0list8.append(c_1_7)else:list8.append(int(c_1_7))# (2,7)c_2_7 = driver.find_element(By.CSS_SELECTOR, '#c_2_7').textif c_2_7 == '':c_2_7 = 0list8.append(c_2_7)else:list8.append(int(c_2_7))# (3,7)c_3_7 = driver.find_element(By.CSS_SELECTOR, '#c_3_7').textif c_3_7 == '':c_3_7 = 0list8.append(c_3_7)else:list8.append(int(c_3_7))# (4,7)c_4_7 = driver.find_element(By.CSS_SELECTOR, '#c_4_7').textif c_4_7 == '':c_4_7 = 0list8.append(c_4_7)else:list8.append(int(c_4_7))# (5,7)c_5_7 = driver.find_element(By.CSS_SELECTOR, '#c_5_7').textif c_5_7 == '':c_5_7 = 0list8.append(c_5_7)else:list8.append(int(c_5_7))# (6,7)c_6_7 = driver.find_element(By.CSS_SELECTOR, '#c_6_7').textif c_6_7 == '':c_6_7 = 0list8.append(c_6_7)else:list8.append(int(c_6_7))# (7,7)c_7_7 = driver.find_element(By.CSS_SELECTOR, '#c_7_7').textif c_7_7 == '':c_7_7 = 0list8.append(c_7_7)else:list8.append(int(c_7_7))# (8,7)c_8_7 = driver.find_element(By.CSS_SELECTOR, '#c_8_7').textif c_8_7 == '':c_8_7 = 0list8.append(c_8_7)else:list8.append(int(c_8_7))list9 = []# (0,8)c_0_8 = driver.find_element(By.CSS_SELECTOR, '#c_0_8').textif c_0_8 == '':c_0_8 = 0list9.append(c_0_8)else:list9.append(int(c_0_8))# (1,8)c_1_8 = driver.find_element(By.CSS_SELECTOR, '#c_1_8').textif c_1_8 == '':c_1_8 = 0list9.append(c_1_8)else:list9.append(int(c_1_8))# (2,8)c_2_8 = driver.find_element(By.CSS_SELECTOR, '#c_2_8').textif c_2_8 == '':c_2_8 = 0list9.append(c_2_8)else:list9.append(int(c_2_8))# (3,8)c_3_8 = driver.find_element(By.CSS_SELECTOR, '#c_3_8').textif c_3_8 == '':c_3_8 = 0list9.append(c_3_8)else:list9.append(int(c_3_8))# (4,8)c_4_8 = driver.find_element(By.CSS_SELECTOR, '#c_4_8').textif c_4_8 == '':c_4_8 = 0list9.append(c_4_8)else:list9.append(int(c_4_8))# (5,8)c_5_8 = driver.find_element(By.CSS_SELECTOR, '#c_5_8').textif c_5_8 == '':c_5_8 = 0list9.append(c_5_8)else:list9.append(int(c_5_8))# (6,8)c_6_8 = driver.find_element(By.CSS_SELECTOR, '#c_6_8').textif c_6_8 == '':c_6_8 = 0list9.append(c_6_8)else:list9.append(int(c_6_8))# (7,8)c_7_8 = driver.find_element(By.CSS_SELECTOR, '#c_7_8').textif c_7_8 == '':c_7_8 = 0list9.append(c_7_8)else:list9.append(int(c_7_8))# (8,8)c_8_8 = driver.find_element(By.CSS_SELECTOR, '#c_8_8').textif c_8_8 == '':c_8_8 = 0list9.append(c_8_8)else:list9.append(int(c_8_8))list = []list.append(list1)list.append(list2)list.append(list3)list.append(list4)list.append(list5)list.append(list6)list.append(list7)list.append(list8)list.append(list9)

我们看看这里会是什么效果:

 

解数独

这里,我们就不说解数独的思路了,我们直接展示代码,代码中的m就是我们上面代码中获取的的列表值,我们只要把m传进去就可以。

    sys.setrecursionlimit(10000)def get_next    (m, x, y):for next_y in range(y + 1, 9): if m[x][next_y] == 0:return x, next_yfor next_x in range(x + 1, 9): for next_y in range(0, 9):if m[next_x][next_y] == 0:return next_x, next_yreturn -1, -1def value (m, x, y)::i, j = x // 3, y // 3grid = [m[i * 3 + r][j * 3 + c] for r in range(3) for c in range(3)]v = set([x for x in range(1, 10)]) - set(grid) - set(m[x]) - \set(list(zip(*m))[y])return list(v)def start_pos(m):for x in range(9):for y in range(9):if m[x][y] == 0:return x, yreturn False, Falsedef try_sudoku (m, x, y)::for v in value(m, x, y):m[x][y] = vnext_x, next_y = get_next(m, x, y)if next_y == -1:  return Trueelse:end = try_sudoku(m, next_x, next_y) if end:return Truem[x][y] = 0  def sudoku(m):x, y = start_pos(m)try_sudoku(m, x, y)print(m)tianxie_shudu(m)sudoku(m)

我们这样就把数独解出来了,接下来,就是来模拟填写数独了。 

 模拟填写数独

这个思路很简单,就是判断数独中空值的地方,就填写对应的数字。

    c_0_0 = driver.find_element(By.CSS_SELECTOR, '#c_0_0').textif c_0_0 == '':print(list_m[0])driver.find_element(By.CSS_SELECTOR, '#c_0_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[0]}').click()time.sleep(1)else:pass

这段代码是通过find_element方法找到一个元素,并获取该元素的文本。然后,它检查这个文本是否为空。如果为空,它会执行以下操作:

  1. 打印一个名为list_m[0]的值。
  2. 找到一个元素,使用CSS选择器'#c_0_0'定位,并模拟点击事件。
  3. 等待1秒钟,以等待页面加载或元素切换等操作完成。
  4. 找到一个元素,使用CSS选择器'#ot{list_m[0]}'定位,并模拟点击事件。
  5. 等待1秒钟,以等待页面加载或元素切换等操作完成。

如果文本不为空,则不执行任何操作,使用pass表示跳过。

其他的都是类似的,我就不一一解释了。下面直接看代码:

    list_m = []for x in m:for y in x:list_m.append(y)print(list_m)driver.find_element(By.CSS_SELECTOR, '#rv').click()c_0_0 = driver.find_element(By.CSS_SELECTOR, '#c_0_0').textif c_0_0 == '':print(list_m[0])driver.find_element(By.CSS_SELECTOR, '#c_0_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[0]}').click()time.sleep(1)else:passc_1_0 = driver.find_element(By.CSS_SELECTOR, '#c_1_0').textif c_1_0 == '':print(list_m[1])driver.find_element(By.CSS_SELECTOR, '#c_1_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[1]}').click()time.sleep(1)else:passc_2_0 = driver.find_element(By.CSS_SELECTOR, '#c_2_0').textif c_2_0 == '':print(list_m[2])driver.find_element(By.CSS_SELECTOR, '#c_2_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[2]}').click()time.sleep(1)else:passc_3_0 = driver.find_element(By.CSS_SELECTOR, '#c_3_0').textif c_3_0 == '':print(list_m[3])driver.find_element(By.CSS_SELECTOR, '#c_3_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[3]}').click()time.sleep(1)else:passc_4_0 = driver.find_element(By.CSS_SELECTOR, '#c_4_0').textif c_4_0 == '':print(list_m[4])driver.find_element(By.CSS_SELECTOR, '#c_4_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[4]}').click()time.sleep(1)else:passc_5_0 = driver.find_element(By.CSS_SELECTOR, '#c_5_0').textif c_5_0 == '':print(list_m[5])driver.find_element(By.CSS_SELECTOR, '#c_5_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[5]}').click()time.sleep(1)else:passc_6_0 = driver.find_element(By.CSS_SELECTOR, '#c_6_0').textif c_6_0 == '':print(list_m[6])driver.find_element(By.CSS_SELECTOR, '#c_6_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[6]}').click()time.sleep(1)else:passc_7_0 = driver.find_element(By.CSS_SELECTOR, '#c_7_0').textif c_7_0 == '':print(list_m[7])driver.find_element(By.CSS_SELECTOR, '#c_7_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[7]}').click()time.sleep(1)else:passc_8_0 = driver.find_element(By.CSS_SELECTOR, '#c_8_0').textif c_8_0 == '':print(list_m[8])driver.find_element(By.CSS_SELECTOR, '#c_8_0').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[8]}').click()time.sleep(1)else:passc_0_1 = driver.find_element(By.CSS_SELECTOR, '#c_0_1').textif c_0_1 == '':print(list_m[9])driver.find_element(By.CSS_SELECTOR, '#c_0_1').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[9]}').click()time.sleep(1)else:passc_1_1 = driver.find_element(By.CSS_SELECTOR, '#c_1_1').textif c_1_1 == '':print(list_m[10])driver.find_element(By.CSS_SELECTOR, '#c_1_1').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[10]}').click()time.sleep(1)else:passc_2_1 = driver.find_element(By.CSS_SELECTOR, '#c_2_1').textif c_2_1 == '':print(list_m[11])driver.find_element(By.CSS_SELECTOR, '#c_2_1').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[11]}').click()time.sleep(1)else:passc_3_1 = driver.find_element(By.CSS_SELECTOR, '#c_3_1').textif c_3_1 == '':print(list_m[12])driver.find_element(By.CSS_SELECTOR, '#c_3_1').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[12]}').click()time.sleep(1)else:passc_4_1 = driver.find_element(By.CSS_SELECTOR, '#c_4_1').textif c_4_1 == '':print(list_m[13])driver.find_element(By.CSS_SELECTOR, '#c_4_1').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[13]}').click()time.sleep(1)else:passc_5_1 = driver.find_element(By.CSS_SELECTOR, '#c_5_1').textif c_5_1 == '':print(list_m[14])driver.find_element(By.CSS_SELECTOR, '#c_5_1').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[14]}').click()time.sleep(1)else:passc_6_1 = driver.find_element(By.CSS_SELECTOR, '#c_6_1').textif c_6_1 == '':print(list_m[15])driver.find_element(By.CSS_SELECTOR, '#c_6_1').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[15]}').click()time.sleep(1)else:passc_7_1 = driver.find_element(By.CSS_SELECTOR, '#c_7_1').textif c_7_1 == '':print(list_m[16])driver.find_element(By.CSS_SELECTOR, '#c_7_1').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[16]}').click()time.sleep(1)else:passc_8_1 = driver.find_element(By.CSS_SELECTOR, '#c_8_1').textif c_8_1 == '':print(list_m[17])driver.find_element(By.CSS_SELECTOR, '#c_8_1').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[17]}').click()time.sleep(1)else:passc_0_2 = driver.find_element(By.CSS_SELECTOR, '#c_0_2').textif c_0_2 == '':print(list_m[18])driver.find_element(By.CSS_SELECTOR, '#c_0_2').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[18]}').click()time.sleep(1)else:passc_1_2 = driver.find_element(By.CSS_SELECTOR, '#c_1_2').textif c_1_2 == '':print(list_m[19])driver.find_element(By.CSS_SELECTOR, '#c_1_2').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[19]}').click()time.sleep(1)else:passc_2_2 = driver.find_element(By.CSS_SELECTOR, '#c_2_2').textif c_2_2 == '':print(list_m[20])driver.find_element(By.CSS_SELECTOR, '#c_2_2').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[20]}').click()time.sleep(1)else:passc_3_2 = driver.find_element(By.CSS_SELECTOR, '#c_3_2').textif c_3_2 == '':print(list_m[21])driver.find_element(By.CSS_SELECTOR, '#c_3_2').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[21]}').click()time.sleep(1)else:passc_4_2 = driver.find_element(By.CSS_SELECTOR, '#c_4_2').textif c_4_2 == '':print(list_m[22])driver.find_element(By.CSS_SELECTOR, '#c_4_2').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[22]}').click()time.sleep(1)else:passc_5_2 = driver.find_element(By.CSS_SELECTOR, '#c_5_2').textif c_5_2 == '':print(list_m[23])driver.find_element(By.CSS_SELECTOR, '#c_5_2').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[23]}').click()time.sleep(1)else:passc_6_2 = driver.find_element(By.CSS_SELECTOR, '#c_6_2').textif c_6_2 == '':print(list_m[24])driver.find_element(By.CSS_SELECTOR, '#c_6_2').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[24]}').click()time.sleep(1)else:passc_7_2 = driver.find_element(By.CSS_SELECTOR, '#c_7_2').textif c_7_2 == '':print(list_m[25])driver.find_element(By.CSS_SELECTOR, '#c_7_2').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[25]}').click()time.sleep(1)else:passc_8_2 = driver.find_element(By.CSS_SELECTOR, '#c_8_2').textif c_8_2 == '':print(list_m[26])driver.find_element(By.CSS_SELECTOR, '#c_8_2').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[26]}').click()time.sleep(1)else:passc_0_3 = driver.find_element(By.CSS_SELECTOR, '#c_0_3').textif c_0_3 == '':print(list_m[27])driver.find_element(By.CSS_SELECTOR, '#c_0_3').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[27]}').click()time.sleep(1)else:passc_1_3 = driver.find_element(By.CSS_SELECTOR, '#c_1_3').textif c_1_3 == '':print(list_m[28])driver.find_element(By.CSS_SELECTOR, '#c_1_3').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[28]}').click()time.sleep(1)else:passc_2_3 = driver.find_element(By.CSS_SELECTOR, '#c_2_3').textif c_2_3 == '':print(list_m[29])driver.find_element(By.CSS_SELECTOR, '#c_2_3').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[29]}').click()time.sleep(1)else:passc_3_3 = driver.find_element(By.CSS_SELECTOR, '#c_3_3').textif c_3_3 == '':print(list_m[30])driver.find_element(By.CSS_SELECTOR, '#c_3_3').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[30]}').click()time.sleep(1)else:passc_4_3 = driver.find_element(By.CSS_SELECTOR, '#c_4_3').textif c_4_3 == '':print(list_m[31])driver.find_element(By.CSS_SELECTOR, '#c_4_3').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[31]}').click()time.sleep(1)else:passc_5_3 = driver.find_element(By.CSS_SELECTOR, '#c_5_3').textif c_5_3 == '':print(list_m[32])driver.find_element(By.CSS_SELECTOR, '#c_5_3').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[32]}').click()time.sleep(1)else:passc_6_3 = driver.find_element(By.CSS_SELECTOR, '#c_6_3').textif c_6_3 == '':print(list_m[33])driver.find_element(By.CSS_SELECTOR, '#c_6_3').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[33]}').click()time.sleep(1)else:passc_7_3 = driver.find_element(By.CSS_SELECTOR, '#c_7_3').textif c_7_3 == '':print(list_m[34])driver.find_element(By.CSS_SELECTOR, '#c_7_3').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[34]}').click()time.sleep(1)else:passc_8_3 = driver.find_element(By.CSS_SELECTOR, '#c_8_3').textif c_8_3 == '':print(list_m[35])driver.find_element(By.CSS_SELECTOR, '#c_8_3').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[35]}').click()time.sleep(1)else:passc_0_4 = driver.find_element(By.CSS_SELECTOR, '#c_0_4').textif c_0_4 == '':print(list_m[36])driver.find_element(By.CSS_SELECTOR, '#c_0_4').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[36]}').click()time.sleep(1)else:passc_1_4 = driver.find_element(By.CSS_SELECTOR, '#c_1_4').textif c_1_4 == '':print(list_m[37])driver.find_element(By.CSS_SELECTOR, '#c_1_4').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[37]}').click()time.sleep(1)else:passc_2_4 = driver.find_element(By.CSS_SELECTOR, '#c_2_4').textif c_2_4 == '':print(list_m[38])driver.find_element(By.CSS_SELECTOR, '#c_2_4').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[38]}').click()time.sleep(1)else:passc_3_4 = driver.find_element(By.CSS_SELECTOR, '#c_3_4').textif c_3_4 == '':print(list_m[39])driver.find_element(By.CSS_SELECTOR, '#c_3_4').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[39]}').click()time.sleep(1)else:passc_4_4 = driver.find_element(By.CSS_SELECTOR, '#c_4_4').textif c_4_4 == '':print(list_m[40])driver.find_element(By.CSS_SELECTOR, '#c_4_4').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[40]}').click()time.sleep(1)else:passc_5_4 = driver.find_element(By.CSS_SELECTOR, '#c_5_4').textif c_5_4 == '':print(list_m[41])driver.find_element(By.CSS_SELECTOR, '#c_5_4').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[41]}').click()time.sleep(1)else:passc_6_4 = driver.find_element(By.CSS_SELECTOR, '#c_6_4').textif c_6_4 == '':print(list_m[42])driver.find_element(By.CSS_SELECTOR, '#c_6_4').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[42]}').click()time.sleep(1)else:passc_7_4 = driver.find_element(By.CSS_SELECTOR, '#c_7_4').textif c_7_4 == '':print(list_m[43])driver.find_element(By.CSS_SELECTOR, '#c_7_4').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[43]}').click()time.sleep(1)else:passc_8_4 = driver.find_element(By.CSS_SELECTOR, '#c_8_4').textif c_8_4 == '':print(list_m[44])driver.find_element(By.CSS_SELECTOR, '#c_8_4').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[44]}').click()time.sleep(1)else:passc_0_5 = driver.find_element(By.CSS_SELECTOR, '#c_0_5').textif c_0_5 == '':print(list_m[45])driver.find_element(By.CSS_SELECTOR, '#c_0_5').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[45]}').click()time.sleep(1)else:passc_1_5 = driver.find_element(By.CSS_SELECTOR, '#c_1_5').textif c_1_5 == '':print(list_m[46])driver.find_element(By.CSS_SELECTOR, '#c_1_5').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[46]}').click()time.sleep(1)else:passc_2_5 = driver.find_element(By.CSS_SELECTOR, '#c_2_5').textif c_2_5 == '':print(list_m[47])driver.find_element(By.CSS_SELECTOR, '#c_2_5').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[47]}').click()time.sleep(1)else:passc_3_5 = driver.find_element(By.CSS_SELECTOR, '#c_3_5').textif c_3_5 == '':print(list_m[48])driver.find_element(By.CSS_SELECTOR, '#c_3_5').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[48]}').click()time.sleep(1)else:passc_4_5 = driver.find_element(By.CSS_SELECTOR, '#c_4_5').textif c_4_5 == '':print(list_m[49])driver.find_element(By.CSS_SELECTOR, '#c_4_5').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[49]}').click()time.sleep(1)else:passc_5_5 = driver.find_element(By.CSS_SELECTOR, '#c_5_5').textif c_5_5 == '':print(list_m[50])driver.find_element(By.CSS_SELECTOR, '#c_5_5').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[50]}').click()time.sleep(1)else:passc_6_5 = driver.find_element(By.CSS_SELECTOR, '#c_6_5').textif c_6_5 == '':print(list_m[51])driver.find_element(By.CSS_SELECTOR, '#c_6_5').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[51]}').click()time.sleep(1)else:passc_7_5 = driver.find_element(By.CSS_SELECTOR, '#c_7_5').textif c_7_5 == '':print(list_m[52])driver.find_element(By.CSS_SELECTOR, '#c_7_5').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[52]}').click()time.sleep(1)else:passc_8_5 = driver.find_element(By.CSS_SELECTOR, '#c_8_5').textif c_8_5 == '':print(list_m[53])driver.find_element(By.CSS_SELECTOR, '#c_8_5').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[53]}').click()time.sleep(1)else:passc_0_6 = driver.find_element(By.CSS_SELECTOR, '#c_0_6').textif c_0_6 == '':print(list_m[54])driver.find_element(By.CSS_SELECTOR, '#c_0_6').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[54]}').click()time.sleep(1)else:passc_1_6 = driver.find_element(By.CSS_SELECTOR, '#c_1_6').textif c_1_6 == '':print(list_m[55])driver.find_element(By.CSS_SELECTOR, '#c_1_6').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[55]}').click()time.sleep(1)else:passc_2_6 = driver.find_element(By.CSS_SELECTOR, '#c_2_6').textif c_2_6 == '':print(list_m[56])driver.find_element(By.CSS_SELECTOR, '#c_2_6').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[56]}').click()time.sleep(1)else:passc_3_6 = driver.find_element(By.CSS_SELECTOR, '#c_3_6').textif c_3_6 == '':print(list_m[57])driver.find_element(By.CSS_SELECTOR, '#c_3_6').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[57]}').click()time.sleep(1)else:passc_4_6 = driver.find_element(By.CSS_SELECTOR, '#c_4_6').textif c_4_6 == '':print(list_m[58])driver.find_element(By.CSS_SELECTOR, '#c_4_6').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[58]}').click()time.sleep(1)else:passc_5_6 = driver.find_element(By.CSS_SELECTOR, '#c_5_6').textif c_5_6 == '':print(list_m[59])driver.find_element(By.CSS_SELECTOR, '#c_5_6').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[59]}').click()time.sleep(1)else:passc_6_6 = driver.find_element(By.CSS_SELECTOR, '#c_6_6').textif c_6_6 == '':print(list_m[60])driver.find_element(By.CSS_SELECTOR, '#c_6_6').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[60]}').click()time.sleep(1)else:passc_7_6 = driver.find_element(By.CSS_SELECTOR, '#c_7_6').textif c_7_6 == '':print(list_m[61])driver.find_element(By.CSS_SELECTOR, '#c_7_6').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[61]}').click()time.sleep(1)else:passc_8_6 = driver.find_element(By.CSS_SELECTOR, '#c_8_6').textif c_8_6 == '':print(list_m[62])driver.find_element(By.CSS_SELECTOR, '#c_8_6').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[62]}').click()time.sleep(1)else:passc_0_7 = driver.find_element(By.CSS_SELECTOR, '#c_0_7').textif c_0_7 == '':print(list_m[63])driver.find_element(By.CSS_SELECTOR, '#c_0_7').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[63]}').click()time.sleep(1)else:passc_1_7 = driver.find_element(By.CSS_SELECTOR, '#c_1_7').textif c_1_7 == '':print(list_m[64])driver.find_element(By.CSS_SELECTOR, '#c_1_7').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[64]}').click()time.sleep(1)else:passc_2_7 = driver.find_element(By.CSS_SELECTOR, '#c_2_7').textif c_2_7 == '':print(list_m[65])driver.find_element(By.CSS_SELECTOR, '#c_2_7').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[65]}').click()time.sleep(1)else:passc_3_7 = driver.find_element(By.CSS_SELECTOR, '#c_3_7').textif c_3_7 == '':print(list_m[66])driver.find_element(By.CSS_SELECTOR, '#c_3_7').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[66]}').click()time.sleep(1)else:passc_4_7 = driver.find_element(By.CSS_SELECTOR, '#c_4_7').textif c_4_7 == '':print(list_m[67])driver.find_element(By.CSS_SELECTOR, '#c_4_7').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[67]}').click()time.sleep(1)else:passc_5_7 = driver.find_element(By.CSS_SELECTOR, '#c_5_7').textif c_5_7 == '':print(list_m[68])driver.find_element(By.CSS_SELECTOR, '#c_5_7').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[68]}').click()time.sleep(1)else:passc_6_7 = driver.find_element(By.CSS_SELECTOR, '#c_6_7').textif c_6_7 == '':print(list_m[69])driver.find_element(By.CSS_SELECTOR, '#c_6_7').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[69]}').click()time.sleep(1)else:passc_7_7 = driver.find_element(By.CSS_SELECTOR, '#c_7_7').textif c_7_7 == '':print(list_m[70])driver.find_element(By.CSS_SELECTOR, '#c_7_7').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[70]}').click()time.sleep(1)else:passc_8_7 = driver.find_element(By.CSS_SELECTOR, '#c_8_7').textif c_8_7 == '':print(list_m[71])driver.find_element(By.CSS_SELECTOR, '#c_8_7').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[71]}').click()time.sleep(1)else:passc_0_8 = driver.find_element(By.CSS_SELECTOR, '#c_0_8').textif c_0_8 == '':print(list_m[72])driver.find_element(By.CSS_SELECTOR, '#c_0_8').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[72]}').click()time.sleep(1)else:passc_1_8 = driver.find_element(By.CSS_SELECTOR, '#c_1_8').textif c_1_8 == '':print(list_m[73])driver.find_element(By.CSS_SELECTOR, '#c_1_8').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[73]}').click()time.sleep(1)else:passc_2_8 = driver.find_element(By.CSS_SELECTOR, '#c_2_8').textif c_2_8 == '':print(list_m[74])driver.find_element(By.CSS_SELECTOR, '#c_2_8').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[74]}').click()time.sleep(1)else:passc_3_8 = driver.find_element(By.CSS_SELECTOR, '#c_3_8').textif c_3_8 == '':print(list_m[75])driver.find_element(By.CSS_SELECTOR, '#c_3_8').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[75]}').click()time.sleep(1)else:passc_4_8 = driver.find_element(By.CSS_SELECTOR, '#c_4_8').textif c_4_8 == '':print(list_m[76])driver.find_element(By.CSS_SELECTOR, '#c_4_8').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[76]}').click()time.sleep(1)else:passc_5_8 = driver.find_element(By.CSS_SELECTOR, '#c_5_8').textif c_5_8 == '':print(list_m[77])driver.find_element(By.CSS_SELECTOR, '#c_5_8').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[77]}').click()time.sleep(1)else:passc_6_8 = driver.find_element(By.CSS_SELECTOR, '#c_6_8').textif c_6_8 == '':print(list_m[78])driver.find_element(By.CSS_SELECTOR, '#c_6_8').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[78]}').click()time.sleep(1)else:passc_7_8 = driver.find_element(By.CSS_SELECTOR, '#c_7_8').textif c_7_8 == '':print(list_m[79])driver.find_element(By.CSS_SELECTOR, '#c_7_8').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[79]}').click()time.sleep(1)else:passc_8_8 = driver.find_element(By.CSS_SELECTOR, '#c_8_8').textif c_8_8 == '':print(list_m[80])driver.find_element(By.CSS_SELECTOR, '#c_8_8').click()time.sleep(1)driver.find_element(By.CSS_SELECTOR, f'#ot{list_m[80]}').click()time.sleep(1)else:pass

我们看看最后的效果吧:

总结

由于篇幅有限,我这个源码会放在评论区或者放个资源,感兴趣的可以自行下载,这个功能其实特别简单,就是简单的selenium的操作,有什么疑问可以在评论区说说。

6adf31c8c5dd4e6a83314f4805b30bc1.jpg


http://www.ppmy.cn/news/794297.html

相关文章

vue.js自定义软键盘“删除键”问题

小项目中需要用到一个自定义的数字软键盘,里面有一个“删除”键,取到数据后发现有错误需要修改,点删除键没作用,但是增加一个数字之后,再点删除就可以了,如图: 这是因为是进行字符串操作&#x…

iOS监听键盘的删除按键事件

需求场景描述 最近项目里有个场景,搜索添加成员的时候,需要类似于微信创建讨论组加人时的效果:启动搜索输入文本,点击删除文本,当文本全删除完的时候,在点击删除按键,可以删除选中的人&#xf…

Android软键盘删除键触发Activity的返回事件

转载请标注: 披萨大叔的博客:http://blog.csdn.net/qq_27258799/article/details/51496102 今天突然发现一个bug,自己的EditText在删除内容时,总会触发Activity的返回事件,可是昨天明明是好好的。于是调试一番才突然醒…

android移除点击监听器,Android - 监听软键盘删除事件

我们项目要做一个类似微博头条文章的图文混排编辑器,在考虑了各种实现方案后,最终定下来的做法就是把每段文字当做一个EditText,每个图片当做一个ImageView,文字和图片放在LinearLayout里。当EditText内容是空的时候,如果用户在软键盘里按删除按钮,要把这个EditText删掉,…

android webview软键盘监听删除键、回车键、其他键

android webview软键盘监听删除键、回车键、其他键 终于有时间来写文章了,头一回发表,文章连贯性可能无法保障,大家勉强看一下吧 今天说点关于android 和 webview 沟通的时候,需要监听软键盘的按键事件的问题 情境描述&#xf…

监听软键盘中的删除键

最近因为项目需要,要监听软键盘中的删除键,在网上搜了大部分的说法,用onKeyListener,但是不知道为什么,设置后并没有效果,最后自己通过dispatchKeyEvent实现了,代码如下 Overridepublic boolean…

JS监听安卓软键盘删除键

web前端开发去整移动端页面真实老折磨了 input反正不论是什么dom肯定都能触发的,那就在input的回调里面看输入类型 这次需求要做光标定位,得上selection和range那一套所以用的是div,但是input也是OK的 然后这个东西好就好在IOS也是兼容的 &…

无源光网络(PON)介绍及其应用

文章目录 1、无源光网络(PON)介绍ONU(Optical Network Unit),光网络单元OLT(Optical line terminal),光线路终端 2、FTTH、FTTB、FTTR组网介绍FTTR组网规划 3、局端接入设备产品介绍…