提交 d08a3407 authored 作者: 周千淇's avatar 周千淇

更新 test点选.py

上级 82b6619c
...@@ -30,7 +30,7 @@ def test_point_captcha_auto_verify(): ...@@ -30,7 +30,7 @@ def test_point_captcha_auto_verify():
is_pass = False is_pass = False
target_rects = [] target_rects = []
try: try:
# 1. 打开页面+触发验证码 # 打开页面+触发验证码
driver.get(VOTE_URL) driver.get(VOTE_URL)
print("打开投票链接,等待加载...") print("打开投票链接,等待加载...")
time.sleep(4) time.sleep(4)
...@@ -51,7 +51,7 @@ def test_point_captcha_auto_verify(): ...@@ -51,7 +51,7 @@ def test_point_captcha_auto_verify():
target_rects = ocr.detection(f.read()) target_rects = ocr.detection(f.read())
print(f"机器识别到 {len(target_rects)} 个目标矩形坐标:{target_rects}") print(f"机器识别到 {len(target_rects)} 个目标矩形坐标:{target_rects}")
# 4点击 # 点击
action = ActionChains(driver) action = ActionChains(driver)
for rect in target_rects: for rect in target_rects:
x1, y1, x2, y2 = rect x1, y1, x2, y2 = rect
...@@ -61,7 +61,7 @@ def test_point_captcha_auto_verify(): ...@@ -61,7 +61,7 @@ def test_point_captcha_auto_verify():
print(f"机器点击矩形中心坐标:({center_x:.1f}, {center_y:.1f})") print(f"机器点击矩形中心坐标:({center_x:.1f}, {center_y:.1f})")
time.sleep(0.1) time.sleep(0.1)
# 5. 验证是否自动通过 # 验证是否自动通过
print("等待验证码自动验证...") print("等待验证码自动验证...")
time.sleep(2) time.sleep(2)
try: try:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论