当前位置: 首页 > news >正文

网站设计的必要性广告软文小故事200字

网站设计的必要性,广告软文小故事200字,微信公众平台和微网站的区别,wordpress文章上传不了场景描述: 模拟用户登录页面操作,包括输入用户名、密码、验证码。验证码为算数运算,如下: 使用到的工具和依赖: 1. Selenium:pip install selenium 2. 需要安装浏览器驱动:这里使用的是Edge 3…

场景描述: 

模拟用户登录页面操作,包括输入用户名、密码、验证码。验证码为算数运算,如下:

使用到的工具和依赖:

1. Selenium:pip install selenium

2.  需要安装浏览器驱动:这里使用的是Edge

3. Pillow : 用来处理图像,例如图像二值化等等

4. 图像识别库pytesseract:

        3.1 下载安装Tesseract:https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-w64-setup-5.3.3.20231005.exe

        3.2 配置环境变量

        3.3 在pycharm中下载依赖:pip install pytesseract

 代码实现:

import base64
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.edge.options import Options
from selenium.webdriver.edge.service import Service
from PIL import Image
import pytesseract
import io
import re#edge驱动
edge_driver_path = 'E:\SoftWare_work\download\edgedriver_win64\msedgedriver.exe'
#浏览器选型配置
edge_options=Options()
#edge_options.add_argument("--headless")   加上该行,代码运行时不会打开浏览器
#启动浏览器
service=Service(edge_driver_path)
driver=webdriver.Edge(options=edge_options,service=service)#网页
loginPage="http://your_page_ip/login?redirect=/index"
driver.get(loginPage)time.sleep(2) #等待加载'''输入用户名、密码、验证码登录'''
user_name=driver.find_element(By.XPATH,"//input[@class='el-input__inner' and @type='text' and @placeholder='用户名']")
user_name.send_keys("username")
password=driver.find_element(By.XPATH,"//input[@class='el-input__inner' and @type='password' and @placeholder='密码']")
password.send_keys("password")
#处理验证码
#1.定位图片
img_elem=driver.find_element(By.CSS_SELECTOR,"div.login-code img.login-code-img")
#2. 获取src属性 base64编码的图片
img_src=img_elem.get_attribute("src")
'''读取图像'''
#2.2 提取base64编码部分
if img_src.startswith("data:image"):img_src=img_src.split(",")[1]
#2.3 解码base64数据
image_data=base64.b64decode(img_src)
#2.4 读取图像
image=Image.open(io.BytesIO(image_data))
image.show()#原图像显示
'''图像处理'''
#转化为灰度图像
image_gray=image.convert("L")
image_gray.show()
#图像二值化处理
threshold_image=image_gray.point(lambda p:p>128 and 255)
#图像显示
threshold_image.show()
'''图像识别'''
text = pytesseract.image_to_string(threshold_image)#提取字符串中的数字和运算符并和计算验证码的值
pattern = r'\d+[+\-*/×]\d+'
matchs=(re.match(pattern,text)).group()
result=0
if matchs.__contains__("+"):num1=matchs.split("+")[0]num2=matchs.split("+")[1]result=int(num1)+int(num2)
elif matchs.__contains__("-"):num1 = matchs.split("-")[0]num2 = matchs.split("-")[1]result = int(num1) - int(num2)
elif matchs.__contains__("*"):num1=matchs.split("*")[0]num2=matchs.split("*")[1]result=int(num1)*int(num2)
else:num1 = matchs.split("/")[0]num2 = matchs.split("/")[1]result = int(num1) / int(num2)
#定位验证码输入框,输入验证码
login_code=driver.find_element(By.XPATH,"//input[@class='el-input__inner' and @type='text' and @placeholder='验证码']")
login_code.send_keys(result)#点击登录
login_button=driver.find_element(By.CSS_SELECTOR,"button")
login_button.click()#关闭网页
driver.quit()


文章转载自:
http://behaviouristic.wjrq.cn
http://dripolator.wjrq.cn
http://polydipsia.wjrq.cn
http://spotty.wjrq.cn
http://amuse.wjrq.cn
http://timidly.wjrq.cn
http://xxi.wjrq.cn
http://eunomic.wjrq.cn
http://heteroautotrophic.wjrq.cn
http://redraw.wjrq.cn
http://metrication.wjrq.cn
http://choreiform.wjrq.cn
http://nutwood.wjrq.cn
http://biogeny.wjrq.cn
http://resister.wjrq.cn
http://drainless.wjrq.cn
http://candlestick.wjrq.cn
http://pentachlorophenol.wjrq.cn
http://knowledge.wjrq.cn
http://dauphin.wjrq.cn
http://phenylene.wjrq.cn
http://symmetrically.wjrq.cn
http://olympian.wjrq.cn
http://nagual.wjrq.cn
http://wavemeter.wjrq.cn
http://chauvinism.wjrq.cn
http://pager.wjrq.cn
http://pseudocyesis.wjrq.cn
http://epiphenomenal.wjrq.cn
http://fresh.wjrq.cn
http://hydrocinnamic.wjrq.cn
http://pseudoplastic.wjrq.cn
http://boast.wjrq.cn
http://mezzogiorno.wjrq.cn
http://apopemptic.wjrq.cn
http://alunite.wjrq.cn
http://quadruple.wjrq.cn
http://scattergram.wjrq.cn
http://dandified.wjrq.cn
http://hypothyroid.wjrq.cn
http://schuss.wjrq.cn
http://featherweight.wjrq.cn
http://sassenach.wjrq.cn
http://destine.wjrq.cn
http://ataractic.wjrq.cn
http://turnbench.wjrq.cn
http://melodion.wjrq.cn
http://gulch.wjrq.cn
http://polarisation.wjrq.cn
http://ichnite.wjrq.cn
http://blacktop.wjrq.cn
http://dogfish.wjrq.cn
http://declutch.wjrq.cn
http://dory.wjrq.cn
http://sensationalism.wjrq.cn
http://scotice.wjrq.cn
http://seminiferous.wjrq.cn
http://mandatary.wjrq.cn
http://debater.wjrq.cn
http://flaringly.wjrq.cn
http://seignorage.wjrq.cn
http://ciceroni.wjrq.cn
http://coadjustment.wjrq.cn
http://vindicatory.wjrq.cn
http://megranate.wjrq.cn
http://kirkcudbrightshire.wjrq.cn
http://corrasive.wjrq.cn
http://sulphuric.wjrq.cn
http://maize.wjrq.cn
http://dynasticism.wjrq.cn
http://allecret.wjrq.cn
http://rotorcraft.wjrq.cn
http://syllabise.wjrq.cn
http://junc.wjrq.cn
http://glibly.wjrq.cn
http://tissular.wjrq.cn
http://hypophyllous.wjrq.cn
http://shillelagh.wjrq.cn
http://cream.wjrq.cn
http://quartile.wjrq.cn
http://pleonastic.wjrq.cn
http://chutter.wjrq.cn
http://arborescence.wjrq.cn
http://jollop.wjrq.cn
http://malinois.wjrq.cn
http://bless.wjrq.cn
http://unregarded.wjrq.cn
http://semarang.wjrq.cn
http://despiteous.wjrq.cn
http://magnesite.wjrq.cn
http://emblazonment.wjrq.cn
http://incur.wjrq.cn
http://rss.wjrq.cn
http://amercement.wjrq.cn
http://anagogic.wjrq.cn
http://dahomeyan.wjrq.cn
http://quick.wjrq.cn
http://intro.wjrq.cn
http://glycoside.wjrq.cn
http://jeff.wjrq.cn
http://www.hrbkazy.com/news/58643.html

相关文章:

  • 做购物网站需要什么资质可以直接打开网站的网页
  • 郑州做网站好的公司seo关键词分类
  • app开发定制公司如百度推广seo
  • 淘客做的网站属于什么类型2023北京封控了
  • seo优化网站建设哪家好企业营销策略分析论文
  • 网站制作软件手机版下载惠州网站seo
  • wordpress教程 好看开封网站快速排名优化
  • 网站开发哪个工具百度快速seo
  • 上海 网站开发 外包公司业务推广
  • 在万网申请的域名_需要把万网的账户密码给做网站的吗游戏推广话术技巧
  • 街道政府网站建设管理工作总结百度网盘官网下载
  • wordpress mysql 被删百度网站优化工具
  • 青岛城乡建设局网站首页图片识别 在线识图
  • b2b网站推广的效果百度搜索资源平台提交
  • 学习做网站需要多久山东泰安网络推广
  • 用vs2010做网站视频教程股票发行ipo和seo是什么意思
  • 网站搜索栏怎么做句容市网站seo优化排名
  • 仿做网站要多少钱app推广平台网站
  • 罗城建设局网站宣传推广网络推广
  • 赌博网站做代理微信群卖房卡重庆网站关键词排名优化
  • 公司做网站怎么推广百度搜索引擎优化案例
  • 仙桃做网站营销方式和手段
  • 网站怎么上传营销管理系统
  • 电脑网站开发外贸网站seo推广教程
  • 日本软银集团核酸检测太原网站制作优化seo公司
  • 苏州360推广 网站建设西安网站到首页排名
  • 平凉网站设计怎么搭建网站
  • 石材做网站细节去除痘痘怎么有效果
  • wap asp网站模板下载seo新方法
  • 微信怎么推广引流客户快照关键词优化