Python selenium 自動化測試 --16--操作驗證碼
阿新 • • 發佈:2021-02-03
使用pytesseract 和 Pillow操作驗證碼
(只能操作簡單的驗證碼)
- 首先需要匯入響應的模組
pip install pytesseract
pip install Pillow
- 進行驗證碼的分析
- 首先是第一種(本次只針對第一種驗證碼來做演示):
# 匯入模組 import pytesseract from selenium import webdriver import time from PIL import Image 1. 擷取整個頁面 2. 根據驗證碼的id 或者 class 等屬性找到 該驗證碼的位置(獲取到左上頂點和右下頂點的位置) 3