找回密码
 加入
搜索
查看: 3783|回复: 4

[网络通信] 内嵌IE打开某些网站导致代码停止运行的问题?求解

[复制链接]
发表于 2012-2-16 00:51:47 | 显示全部楼层 |阅读模式
SnVuR3VvR3Vv(37666***)  0:40:15
请问有人遇到过 navigate 访问一下特殊的网址,导致程序停止继续执行吗?
例如 navigate("http://www.takungpao.com")
半*(199**)  0:40:44

SnVuR3VvR3Vv(37666***)  0:41:06
但是 navigate("http://qq.com")
就能继续执行
www.takungpao.com
访问这个网址,程序就停止了
目前只遇到这个一个网址了
SnVuR3VvR3Vv(37666***)  0:42:19
“半*” 可否指点一下

半*(199**)  0:42:43
navigate("http://www.takungpao.com",0)
SnVuR3VvR3Vv(37666***)  0:42:58
就是不等待,执行下一步?
半*(199**)  0:42:58
这样就会直接反回了
SnVuR3VvR3Vv(37666***)  0:43:06
这个参数,+了
对这个网址没用
半*(199**)  0:43:17
在后面加判判
SnVuR3VvR3Vv(37666***)  0:43:31
我发个片段,你可以测试一下



#include <IE.au3>
Dim $results_WebCapture = ""
Local $Form2 = GUICreate("", 1024, 768, -1, -1)
GUISetState(@SW_SHOW)

Local $oIE = ObjCreate("Shell.Explorer.2")

Local $obj_IE = GUICtrlCreateObj($oIE, 0, 0, 1024, 768)

Local $EventObject = ObjEvent($oIE, "IEEvent_", "DWebBrowserEvents")

$oIE.navigate("http://www.takungpao.com", 0)
;~ $oIE.navigate("http://www.qq.com", 0)


Local $navigate_state = 0
Local $Timer_navigate = TimerInit()
Local $timeout = 20
While 1
        Local $readyState
        Switch $oIE.readyState
                Case 0
                        $readyState = "(1/5)初始化..."
                Case 1
                        $readyState = "(2/5)正在发送请求..."
                Case 2
                        $readyState = "(3/5)已经接收到全部响应内容..."
                Case 3
                        $readyState = "(4/5)正在解析响应内容..."
                Case 4
                        $readyState = "(5/5)响应内容解析完成."
        EndSwitch
        
;~         ConsoleWrite($readyState & "距离超时(s):" & Int(($timeout * 1000 - TimerDiff($Timer_navigate)) / 1000))
        If $oIE.readyState = 4 And $oIE.busy = False Then ;Or ;$oIE.readyState =  And Then ;$oIE.busy = False; And $oIE.busy = False ;
                $navigate_state = 1
                ExitLoop
        EndIf
        If TimerDiff($Timer_navigate) >= $timeout * 1000 Then ;访问超时
                $navigate_state = -1
                ExitLoop
        EndIf
        ConsoleWrite(Random(0, 1000) & @CRLF)
        Sleep(10)
WEnd


While 1
        Sleep(5)
WEnd




其他网址都会 执行后面的代码
但这个网址,就不能
半*(199**)  0:44:30
你要加个判断
SnVuR3VvR3Vv(37666***)  0:44:57
判断什么呢?
$oIE.readyState=1 的时候就停止了

代码就不会继续了
SnVuR3VvR3Vv(37666***)  0:45:57
蛋疼
SnVuR3VvR3Vv(37666***)  0:47:02
陷入等待。。。但是网站实际是打开了
发表于 2012-2-16 01:06:51 | 显示全部楼层
While 1
        Sleep(5)
WEnd
是干什么的?前面的部分没有问题,跳出第一个while以后进入第二个while死循环了,什么都不干
发表于 2012-2-16 01:11:37 | 显示全部楼层

#include <IE.au3>
Dim $results_WebCapture = ""
Local $Form2 = GUICreate("", 1024, 768, -1, -1)
GUISetState(@SW_SHOW)

Local $oIE = ObjCreate("Shell.Explorer.2")

Local $obj_IE = GUICtrlCreateObj($oIE, 0, 0, 1024, 768)

Local $EventObject = ObjEvent($oIE, "IEEvent_", "DWebBrowserEvents")

$oIE.navigate("http://www.takungpao.com", 0)
;~ $oIE.navigate("http://www.qq.com", 0)


Local $navigate_state = 0
Local $Timer_navigate = TimerInit()
Local $timeout = 20
While 1
        Local $readyState
        Switch $oIE.readyState
                Case 0
                        $readyState = "(1/5)初始化..."
                Case 1
                        $readyState = "(2/5)正在发送请求..."
                Case 2
                        $readyState = "(3/5)已经接收到全部响应内容..."
                Case 3
                        $readyState = "(4/5)正在解析响应内容..."
                Case 4
                        $readyState = "(5/5)响应内容解析完成."
        EndSwitch
        
;~         ConsoleWrite($readyState & "距离超时(s):" & Int(($timeout * 1000 - TimerDiff($Timer_navigate)) / 1000))
        If $oIE.readyState = 4 And $oIE.busy = False Then ;Or ;$oIE.readyState =  And Then ;$oIE.busy = False; And $oIE.busy = False ;
                $navigate_state = 1
                ExitLoop
        EndIf
        If TimerDiff($Timer_navigate) >= $timeout * 1000 Then ;访问超时
                $navigate_state = -1
                ExitLoop
        EndIf
        ConsoleWrite("while 1                      " &Random(0, 1000) & @CRLF)
        Sleep(10)
WEnd


While 1
        ConsoleWrite ("while 2                          " &Random(0, 1000) & @CRLF)
        Sleep(500)
WEnd


+>01:09:37 开始执行 ACNWrapper v.1.0.1.1
+> ============================================
+>执行环境:
+>        CPU构架:        X64
+>        系统构架:        X86
+>        系统语言:        0804
+>        键盘布局:        00000804
+>        内存总量:        1015MB
+>        内存剩余:        225MB
+>        操作系统:        WIN_XP/Service Pack 3
+>        AU3版本:        3.3.7.23
+> ============================================
>运行 AU3Check (1.54.22.0)  开始目录:D:\wfj\autoit3
+>01:09:37 AU3Check 完成[CODE]:0
>运行:(3.3.7.23):D:\wfj\autoit3\autoit3.exe "C:\Documents and Settings\Administrator\桌面\asdsss.au3"   
while 1                      714.204205898568
while 1                      956.716024316847
while 1                      842.035918030888
while 1                      250.359866768122
while 1                      696.650239871815
while 1                      351.948774186894
while 1                      709.186113905162
while 1                      97.6618437562138
while 1                      775.53043118678
while 1                      109.319533221424
while 1                      206.994311418384
while 1                      960.256648482755
while 1                      722.952502546832
while 1                      84.2156575527042
while 1                      816.218809690326
while 1                      167.480804026127
while 1                      153.44321122393
while 1                      767.729548038915
while 1                      992.561152204871
while 1                      672.645202372223
while 1                      568.482857663184
while 1                      399.732012301683
while 1                      328.133599832654
while 1                      516.90172101371
while 1                      450.70703048259
while 1                      755.492891417816
while 1                      642.489632824436
while 1                      796.057652216405
while 1                      19.7284705936909
while 1                      851.07520618476
while 1                      965.09090741165
while 1                      563.929067924619
while 1                      894.319329177961
while 1                      34.1055756434798
while 1                      697.95166188851
while 1                      749.744767323136
while 1                      387.487394036725
while 1                      737.030297284946
while 1                      357.088909018785
while 1                      752.912627765909
while 1                      959.094098070636
while 1                      257.589186774567
while 1                      912.603289587423
while 1                      576.352027477697
while 1                      363.133018836379
while 1                      321.619944181293
while 1                      533.892237348482
while 1                      604.7970992513
while 1                      185.897530289367
while 1                      810.604331316426
while 1                      582.353261765093
while 1                      881.129528395832
while 1                      687.1029259637
while 1                      409.183246549219
while 1                      287.200376391411
while 1                      306.514440337196
while 1                      459.969269344583
while 1                      385.957865742967
while 1                      489.420851459727
while 1                      64.0211291611195
while 1                      909.291373100132
while 1                      432.170958956704
while 1                      503.630549879745
while 1                      582.771724788472
while 1                      932.988880435005
while 1                      538.902836386114
while 1                      700.111164711416
while 1                      876.07245426625
while 1                      332.697035279125
while 1                      135.439890436828
while 1                      370.09614193812
while 1                      660.807999083772
while 1                      697.619429789484
while 1                      264.00743285194
while 1                      18.3286962565035
while 1                      116.343484027311
while 1                      376.195153221488
while 1                      278.876985190436
while 1                      304.150195559487
while 1                      69.699275540188
while 1                      640.434755478054
while 1                      994.811728363857
while 1                      0.106856226921082
while 1                      157.899236539379
while 1                      330.621026456356
while 1                      147.773665608838
while 1                      103.754391660914
while 1                      987.807020777836
while 1                      34.9411289207637
while 1                      543.947431026027
while 1                      413.438795832917
while 1                      39.2247920390219
while 1                      559.519661590457
while 1                      270.508344052359
while 1                      140.727050602436
while 1                      891.616425709799
while 1                      475.193454185501
while 1                      495.160170365125
while 1                      643.103595590219
while 1                      201.31231402047
while 1                      7.30830896645784
while 1                      835.431984160095
while 1                      126.505010295659
while 1                      671.04147025384
while 1                      550.334817264229
while 1                      122.513605980203
while 1                      915.673032402992
while 1                      161.805409938097
while 1                      46.4416523464024
while 1                      829.541551182047
while 1                      76.3096169102937
while 1                      463.714598445222
while 1                      915.192327229306
while 1                      710.333479102701
while 1                      117.618242977187
while 1                      785.229281289503
while 1                      819.198996061459
while 1                      491.60319310613
while 1                      590.179617749527
while 1                      50.1226140186191
while 1                      944.762396393344
while 1                      687.27478897199
while 1                      362.411573296413
while 1                      68.593523465097
while 1                      724.691037088633
while 1                      361.767175840214
while 1                      164.849338121712
while 1                      275.380819803104
while 1                      869.422849034891
while 1                      186.295925406739
while 1                      203.097231918946
while 1                      179.692376637831
while 1                      404.918863903731
while 1                      623.895189957693
while 1                      628.647327888757
while 1                      55.9509086888283
while 1                      183.809894835576
while 1                      507.318438496441
while 1                      766.352930571884
while 1                      604.141280055046
while 1                      0.91934553347528
while 1                      657.898695208132
while 1                      250.049281865358
while 1                      332.637710263953
while 1                      419.209394138306
while 1                      330.525010125712
while 1                      609.508468303829
while 1                      760.826875921339
while 1                      191.860758233815
while 1                      641.106229275465
while 1                      251.513617113233
while 1                      430.911124451086
while 1                      342.160813976079
while 1                      188.9476145152
while 1                      880.183003377169
while 1                      725.105700315908
while 1                      943.209027638659
while 1                      463.752863695845
while 1                      885.305908741429
while 1                      917.857530293986
while 1                      3.90763161703944
while 1                      103.892758721486
while 1                      355.283113662153
while 1                      924.241550266743
while 1                      458.3322214894
while 1                      936.231208965182
while 1                      49.6011613868177
while 1                      638.60114547424
while 1                      931.201587431133
while 1                      88.8516919221729
while 1                      689.315937226638
while 1                      892.686145147309
while 1                      867.154151666909
while 1                      225.397490197793
while 1                      35.2764774579555
while 1                      111.122634261847
while 1                      675.78635760583
while 1                      462.182861752808
while 1                      800.422077300027
while 1                      64.1381880268455
while 1                      752.919678110629
while 1                      181.750608375296
while 1                      69.0319591667503
while 1                      382.051936350763
while 1                      856.983620673418
while 1                      702.540717087686
while 1                      49.1893186699599
while 1                      654.538680100814
while 1                      151.405369630083
while 1                      159.95390410535
while 1                      787.566493730992
while 1                      734.35841081664
while 1                      687.5866279006
while 1                      55.9757885057479
while 1                      541.902143275365
while 1                      163.191764848307
while 1                      61.9215082842857
while 1                      858.199264621362
while 1                      585.025823209435
while 1                      686.606052098796
while 1                      837.313129799441
while 1                      934.268863406032
while 1                      707.067099632695
while 1                      865.770652657375
while 1                      286.178992828354
while 1                      646.163851721212
while 1                      396.774403750896
while 1                      482.093843631446
while 1                      444.490953115746
while 1                      289.525849977508
while 1                      461.335421074182
while 1                      13.7292838189751
while 1                      582.697108155116
while 1                      274.775661993772
while 1                      555.064347339794
while 1                      836.121024331078
while 1                      386.145558906719
while 1                      409.118198789656
while 1                      695.229058153927
while 1                      554.960161913186
while 1                      67.4247543793172
while 1                      56.9690258707851
while 1                      907.068216707557
while 1                      44.9555970262736
while 1                      873.130186693743
while 1                      135.37275721319
while 1                      603.528022067621
while 1                      236.030119704083
while 1                      239.7448529955
while 1                      938.962860032916
while 1                      692.905422765762
while 1                      812.345800222829
while 1                      741.630063857883
while 1                      908.121330430731
while 1                      124.961836729199
while 1                      960.215755039826
while 1                      361.893225228414
while 1                      109.674799256027
while 1                      992.561389924958
while 1                      945.718257455155
while 1                      958.905521547422
while 1                      631.614609388635
while 1                      173.36545069702
while 2                          319.337052060291
while 2                          519.278184976429
while 2                          890.755337662995
while 2                          590.45601147227
while 2                          510.052123805508
while 2                          876.188667258248
while 2                          809.791185427457
while 2                          789.548188680783
while 2                          543.610294582322
while 2                          994.232271332294
while 2                          998.165481258184
while 2                          689.784522168338
while 2                          399.617553455755
while 2                          556.862940546125
while 2                          435.694201150909
while 2                          614.416411845014
while 2                          897.229575552046
while 2                          605.126327136531
+>01:09:57 AutoIT3.exe 完成:[CODE]:0
+>01:09:58 ACNWrapper 完成..
>退出代码: 0        运行时间: 21.257 秒
 楼主| 发表于 2012-2-16 01:34:39 | 显示全部楼层
回复 3# 骗子


我这边,WHILE2 执行不到
发表于 2012-2-16 03:40:24 | 显示全部楼层
看看你AU3的版本吧,操作IE我觉得好像是3.6.2最好了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-4 08:42 , Processed in 0.076711 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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