Open slsl00 opened 2 years ago
验证码识别是准确的吗?
好像是不准确, 填入的字和圖像不同。未能登入就跳出了。謝謝。
好像是不准确, 填入的字和圖像不同。未能登入就跳出了。謝謝。
可以试一下在识别部分的代码前加上这个,在文字识别前先进行图像的处理,看能否提高识别准确率,稍后我会把这个改动并入到main分支
import cv2
import numpy as np
im = cv2.imread('spider/code.png')
im_gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
ret, im_inv = cv2.threshold(im_gray,50,255,cv2.THRESH_BINARY_INV)
kernel = 1/16*np.array([[1,2,1], [2,4,2], [1,2,1]])
im_blur = cv2.filter2D(im_inv,-1,kernel)
ret, im_res = cv2.threshold(im_blur,127,255,cv2.THRESH_BINARY)
cv2.imwrite('spider/test.png',im_res)
with open('spider/test.png','rb') as f:
img_bytes=f.read()
res=ocr.classification(img_bytes)
print(res)
DevTools listening on ws://127.0.0.1:54617/devtools/browser/7cdab099-6758-47be-bff6-ce7a2d8c9997
欢迎使用ddddocr,本项目专注带动行业内卷,个人博客:wenanzhe.com
训练数据支持来源于:http://146.56.204.113:19199/preview
爬虫框架feapder可快速一键接入,快速开启爬虫之旅:https://github.com/Boris-code/feapder
j
1y37j
Traceback (most recent call last):
File "C:\Users\user\spider\main.py", line 67, in
验证码能识别了, 但仍不能登入。謝謝。
DevTools listening on ws://127.0.0.1:54617/devtools/browser/7cdab099-6758-47be-bff6-ce7a2d8c9997 欢迎使用ddddocr,本项目专注带动行业内卷,个人博客:wenanzhe.com 训练数据支持来源于:http://146.56.204.113:19199/preview 爬虫框架feapder可快速一键接入,快速开启爬虫之旅:https://github.com/Boris-code/feapder j 1y37j Traceback (most recent call last): File "C:\Users\user\spider\main.py", line 67, in
browser.find_element_by_id('btn_login').click() File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 89, in click self._execute(Command.CLICK_ELEMENT) File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 773, in _execute return self._parent.execute(command, params) File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 430, in execute self.error_handler.check_response(response) File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (464, 640). Other element would receive the click: (Session info: chrome=102.0.5005.115) Stacktrace: Backtrace: Ordinal0 [0x007CD953+2414931] Ordinal0 [0x0075F5E1+1963489] Ordinal0 [0x0064C6B8+837304] Ordinal0 [0x0067FC27+1047591] Ordinal0 [0x0067DC08+1039368] Ordinal0 [0x0067B90B+1030411] Ordinal0 [0x0067A659+1025625] Ordinal0 [0x00670293+983699] Ordinal0 [0x0069449C+1131676] Ordinal0 [0x0066FC74+982132] Ordinal0 [0x006946B4+1132212] Ordinal0 [0x006A4812+1198098] Ordinal0 [0x006942B6+1131190] Ordinal0 [0x0066E860+976992] Ordinal0 [0x0066F756+980822] GetHandleVerifier [0x00A3CC62+2510274] GetHandleVerifier [0x00A2F760+2455744] GetHandleVerifier [0x0085EABA+551962] GetHandleVerifier [0x0085D916+547446] Ordinal0 [0x00765F3B+1990459] Ordinal0 [0x0076A898+2009240] Ordinal0 [0x0076A985+2009477] Ordinal0 [0x00773AD1+2046673] BaseThreadInitThunk [0x762EFA29+25] RtlGetAppContainerNamedObjectPath [0x77BD7A7E+286] RtlGetAppContainerNamedObjectPath [0x77BD7A4E+238] 验证码能识别了, 但仍不能登入。謝謝。
看样子还是卡在了登录界面,网页有出现提示框吗?比如验证码错误,没有选择证件类型这种
网页有出现提示框吗?没有 比如验证码错误,没有选择证件类型这种 -> 看了所有輸入都正確, 证件类型也選了。
謝謝!
网页有出现提示框吗?没有 比如验证码错误,没有选择证件类型这种 -> 看了所有輸入都正確, 证件类型也選了。
謝謝!
有尝试过手动点击那个登入按钮吗,如果信息都正确应该是可以正常跳转的
剛留意到頁面彈出了一個"溫馨提示" , 需要按確定
剛留意到頁面彈出了一個"溫馨提示" , 需要按確定
可以尝试用以下方法定位并点击元素:
browser.find_element_by_xpath('//div[@class="flex1"]/button').click()
Traceback (most recent call last):
File "c:\Users\user\spider\main.py", line 66, in
Traceback (most recent call last): File "c:\Users\user\spider\main.py", line 66, in browser.find_element_by_xpath('//div[@Class="flex1"]/button').click() File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 89, in click self._execute(Command.CLICK_ELEMENT) File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 773, in _execute return self._parent.execute(command, params) File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 430, in execute self.error_handler.check_response(response) File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable (Session info: chrome=102.0.5005.115)
或者试一下这个
browser.find_element_by_xpath('//div[@id="winLoginNotice"]/div/div/button').click()
已成功登入, 但選擇日期頁面閃退了
已成功登入, 但選擇日期頁面閃退了
能够复现或者有报错提示吗,有很多种可能都会导致浏览器的闪退,例如内存不足、Chromedriver版本与Chrome不匹配…
可以修改代码持續輸入驗證碼,我一般都是提前4分钟運行程序
DevTools listening on ws://127.0.0.1:58690/devtools/browser/ea4be496-39f0-49d8-a26d-7d74cc4d1276 欢迎使用ddddocr,本项目专注带动行业内卷,个人博客:wenanzhe.com 训练数据支持来源于:http://146.56.204.113:19199/preview 爬虫框架feapder可快速一键接入,快速开启爬虫之旅:https://github.com/Boris-code/feapder bua Traceback (most recent call last): File "C:\Users\user\spider\main.py", line 50, in
browser.find_element_by_id('btn_login').click()
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 89, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 773, in _execute
return self._parent.execute(command, params)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 430, in execute
self.error_handler.check_response(response)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (464, 640). Other element would receive the click:
(Session info: chrome=102.0.5005.115)
Stacktrace:
Backtrace:
Ordinal0 [0x00F1D953+2414931]
Ordinal0 [0x00EAF5E1+1963489]
Ordinal0 [0x00D9C6B8+837304]
Ordinal0 [0x00DCFC27+1047591]
Ordinal0 [0x00DCDC08+1039368]
Ordinal0 [0x00DCB90B+1030411]
Ordinal0 [0x00DCA659+1025625]
Ordinal0 [0x00DC0293+983699]
Ordinal0 [0x00DE449C+1131676]
Ordinal0 [0x00DBFC74+982132]
Ordinal0 [0x00DE46B4+1132212]
Ordinal0 [0x00DF4812+1198098]
Ordinal0 [0x00DE42B6+1131190]
Ordinal0 [0x00DBE860+976992]
Ordinal0 [0x00DBF756+980822]
GetHandleVerifier [0x0118CC62+2510274]
GetHandleVerifier [0x0117F760+2455744]
GetHandleVerifier [0x00FAEABA+551962]
GetHandleVerifier [0x00FAD916+547446]
Ordinal0 [0x00EB5F3B+1990459]
Ordinal0 [0x00EBA898+2009240]
Ordinal0 [0x00EBA985+2009477]
Ordinal0 [0x00EC3AD1+2046673]
BaseThreadInitThunk [0x762EFA29+25]
RtlGetAppContainerNamedObjectPath [0x77BD7A7E+286]
RtlGetAppContainerNamedObjectPath [0x77BD7A4E+238]