提交 17e7120f 作者: 薛凌堃

test

上级 55d1a789
......@@ -46,6 +46,11 @@ import requests, time, random, json, pymysql, redis
import urllib3
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from obs import ObsClient
from kafka import KafkaProducer
......@@ -89,10 +94,21 @@ if __name__=="__main__":
browser.get(url)
# 可改动
time.sleep(20)
page_source = browser.page_source
soup = BeautifulSoup(page_source, 'html.parser')
img_url = soup.select('img[id="captchaImg"]')[0]['src']
screen_img_path = "D:/screen/xxx.png"
out_img_path = "D:/out/xxx.png"
ele = driver.find_element(By.ID, 'XXXX')
browser.find_element(By.ID, 'pName').send_keys('北京远翰国际教育咨询有限责任公司')
code = use_ocr(out_img_path)
验证码输入框元素.send_keys(code)
browser.find_element(By.ID, 'yzm').send_keys(yzm)
browser.find_element(By.ID, 'searchForm').click()
wait = WebDriverWait(browser, 30)
wait.until(EC.presence_of_element_located((By.TAG_NAME, "body")))
# screen_img_path = "D:/screen/xxx.png"
# out_img_path = "D:/out/xxx.png"
# ele = driver.find_element(By.ID, 'XXXX')
#
# code = use_ocr(out_img_path)
# 验证码输入框元素.send_keys(code)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论