找回密码
 加入
搜索
查看: 3010|回复: 5

这个页面的验证码获取不到

[复制链接]
发表于 2008-12-28 14:47:18 | 显示全部楼层 |阅读模式
https://sso.114mall.com.cn:80/ss ... NCTPay%2flogon.aspx
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

$Form1 = GUICreate("验证码窗口演示   QQ:76594695  帅哥命苦 ", 333, 211)
$Label1 = GUICtrlCreateLabel("验证码:", 16,43, 70, 17)
GUICtrlSetFont(-1, 12, 400, 0, "黑体")
GUICtrlSetColor(-1, 0xFF0000)
$Button1 = GUICtrlCreateButton("更换验证码", 112, 150, 97, 33, 0)
$oIE_code = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($oIE_code, 80,24,150,50);定义内嵌IE 窗口大小
_IENavigate ($oIE_code, "about:blank",1)
;加载一个空白网页,可以自定一个网页,让验证码图片显示左左对齐,顶部对齐,如果你会HTML应该明白什么意思
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, 'IE加载中...', "afterbegin");在嵌入IE底部追加文字

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;$oIE = _IECreate ("https://login.sina.com.cn/cgi/register/reg_sso.php");打开带验证码的网页,可以隐藏IE
$oIE = _IECreate ("https://sso.114mall.com.cn:80/sso/login?service=http%3a%2f%2fwww.114mall.cn%2fNCTPay%2flogon.aspx");打开带验证码的网页,可以隐藏IE
Get_code()
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                 _IEQuit ($oIE);退出脚本关闭IE
                        Exit
        Case $Button1
             _IELinkClickByText($oIE,"看不清?换一张")
             Sleep(300);如果不能同步网页中的图片这个延迟要大点,可能跟网速有关系吧
             Get_code()
        EndSwitch
WEnd

Func Get_code()
$oImg = _IEImgGetCollection ($oIE,8);返回IE文档内IMG 实际上就是第4+1张图
$oPic = $oIE.Document.body.createControlRange()
$oPic.Add($oImg)
$oPic.execCommand("Copy");复制到剪贴板
$ImageFilePath = ClipGet();获取路径,在临时文件里面
 _IEAction ( $oIE_code,"refresh" );刷新嵌入IE页面
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, '<img src='& FileGetShortName($ImageFilePath) &'>', "afterbegin");在嵌入IE底部追加图片显示
EndFunc



已经解决,谢谢各位的帮助
代码如下
#include <IE.au3>
#include <GUIConstants.au3>
#include <ClipBoard.au3>
#include <GDIPlus.au3>
#include <Winapi.au3>
;$OpenPage = _IECreate("https://passport.baidu.com/?reg")
$OpenPage = _IECreate("http://ent.114mall.cn/ssoservice/Login.aspx")
$iVerifyPic = _IEImgGetCollection($OpenPage, 8)
_GDIPlus_Startup()
$iVerifyPics = $OpenPage.Document.body.createControlRange()
$iVerifyPics.add($iVerifyPic)
$iVerifyPics.Select ()
$iVerifyPics.execCommand('Copy')
Sleep(500)
_ClipBoard_Open(0)
$iVerifyPics = _ClipBoard_GetDataEx($CF_BITMAP)
$iVerifyPics = _GDIPlus_BitmapCreateFromHBITMAP($iVerifyPics)
_ClipBoard_Close()
FileDelete(@TempDir & "\VerifyPic.bmp")
_GDIPlus_ImageSaveToFile($iVerifyPics, @TempDir & "\VerifyPic.bmp")
GUICreate("VerifyPic", 150, 150, -1, -1, -1)
GUISetBkColor(0xFFFFFF)
GUISetState()
$Img = GUICtrlCreatePic(@TempDir & "\VerifyPic.bmp", 10, 20, _GDIPlus_ImageGetWidth($iVerifyPics), _GDIPlus_ImageGetHeight($iVerifyPics))
_GDIPlus_BitmapDispose($iVerifyPics)
_GDIPlus_Shutdown()
While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then
                GUIDelete()
                ExitLoop
        EndIf
WEnd


[ 本帖最后由 zzzhanghc 于 2008-12-30 08:55 编辑 ]
发表于 2008-12-28 22:41:31 | 显示全部楼层
发表于 2008-12-29 10:51:14 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

$Form1 = GUICreate("验证码窗口演示     ", 333, 211)
$Label1 = GUICtrlCreateLabel("验证码:", 16,43, 70, 17)
GUICtrlSetFont(-1, 12, 400, 0, "黑体")
GUICtrlSetColor(-1, 0xFF0000)
$Button1 = GUICtrlCreateButton("更换验证码", 112, 150, 97, 33, 0)
$oIE_code = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($oIE_code, 80,24,150,50);定义内嵌IE 窗口大小
_IENavigate ($oIE_code, "about:blank",1)
;加载一个空白网页,可以自定一个网页,让验证码图片显示左左对齐,顶部对齐,如果你会HTML应该明白什么意思
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, 'IE加载中...', "afterbegin");在嵌入IE底部追加文字

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;$oIE = _IECreate ("https://login.sina.com.cn/cgi/register/reg_sso.php");打开带验证码的网页,可以隐藏IE
$oIE = _IECreate ("https://sso.114mall.com.cn:80/sso/login?service=http%3a%2f%2fwww.114mall.cn%2fNCTPay%2flogon.aspx",0,0);打开带验证码的网页,可以隐藏IE
Get_code()
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                 _IEQuit ($oIE);退出脚本关闭IE
                        Exit
        Case $Button1
             Get_code()
        EndSwitch
WEnd

Func Get_code()
 _IEAction ( $oIE_code,"refresh" );刷新嵌入IE页面
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, '<img src='& FileGetShortName("https://sso.114mall.com.cn:80/sso/imageValidate") &'>', "afterbegin");在嵌入IE底部追加图片显示
EndFunc

你要的是不是这个效果?

[ 本帖最后由 gaofali258 于 2008-12-29 10:56 编辑 ]
 楼主| 发表于 2008-12-29 17:39:12 | 显示全部楼层
谢谢以上各位的回复!
我没有说清楚问题:
1.我要获取已经打开页面的验证码$oIE = _IECreate ("https://sso.114mall.com.cn:80/sso/login?service=http%3a%2f%2fwww.114mall.cn%2fNCTPay%2flogon.aspx");
2.这个IE中的验证码和https://sso.114mall.com.cn:80/sso/imageValidate是不一样的
应为1和2是两次不同的请求,所以不一样啊
发表于 2008-12-29 18:03:56 | 显示全部楼层
发表于 2010-1-26 22:23:48 | 显示全部楼层
又是空贴。。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-28 02:12 , Processed in 0.077321 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表