LeonLai Posted September 6, 2018 Posted September 6, 2018 this is my code why can' I get the http://blog.sina.com.tw/bwrbwrbqrthbby/article.php?pbgid=112619&entryid=668870 this page's html It always read the http://blog.sina.com.tw/bwrbwrbqrthbby/ page's html god please help me #include <IE.au3> #include <Inet.au3> #include <MsgBoxConstants.au3> $oIE = _IECreate("http://blog.sina.com.tw/bwrbwrbqrthbby/") _IELoadWait($oIE) _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.href = "http://blog.sina.com.tw/bwrbwrbqrthbby/article.php?pbgid=112619&entryid=668870" Then _IEAction($oLink, "click") _IELoadWait($oIE) ExitLoop EndIf Next Sleep(2000) $sHTML = _IEDocReadHTML($oIE)
FrancescoDiMuro Posted September 6, 2018 Posted September 6, 2018 Hi @LeonLai, and welcome to the AutoIt forum 3 hours ago, LeonLai said: It always read the http://blog.sina.com.tw/bwrbwrbqrthbby/ page's html because of this: 3 hours ago, LeonLai said: $oIE = _IECreate("http://blog.sina.com.tw/bwrbwrbqrthbby/")$sHTML = _IEDocReadHTML($oIE) You need to navigate to that link, and not just click it Try this If $oLink.href = "http://blog.sina.com.tw/bwrbwrbqrthbby/article.php?pbgid=112619&entryid=668870" Then _IENavigate($oIE, $oLink.href) ExitLoop EndIf $sHTML = _IEDocReadHTML($oIE) and let us know Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
LeonLai Posted September 6, 2018 Author Posted September 6, 2018 But I need the AU3 help me to do view the page Can you show me how to do that?
LeonLai Posted September 6, 2018 Author Posted September 6, 2018 If I change the code like this #include <IE.au3> #include <Inet.au3> #include <MsgBoxConstants.au3> $oIE = _IECreate("http://blog.sina.com.tw/bwrbwrbqrthbby/") _IELoadWait($oIE) _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.href = "http://blog.sina.com.tw/bwrbwrbqrthbby/article.php?pbgid=112619&entryid=668870" Then _IEAction($oLink, "click") _IELoadWait($oIE) _IENavigate($oIE, $oLink) ExitLoop EndIf Next Sleep(2000) $sHTML = _IEDocReadHTML($oIE) and it just stop still can't read the html i need
FrancescoDiMuro Posted September 6, 2018 Posted September 6, 2018 (edited) @LeonLai Study this code: expandcollapse popup#include <IE.au3> #include <MsgBoxConstants.au3> Global $oIE, _ $oLinks, _ $strLink = "" Global $oIE = _IECreate("http://blog.sina.com.tw/bwrbwrbqrthbby/") If @error Then ConsoleWrite("_IECreate() = Error: " & @error & @CRLF) Else ConsoleWrite("START DEBUGGING:" & @CRLF & @CRLF) ConsoleWrite("_IECreate() = Ok" & @CRLF) Global $oLinks = _IELinkGetCollection($oIE) If @error Then ConsoleWrite("_IELinkGetCollection() = Error: " & @error & @CRLF) Else ConsoleWrite("_IELinkGetCollection() = Ok" & @CRLF) For $oLink In $oLinks If $oLink.href = "http://blog.sina.com.tw/bwrbwrbqrthbby/article.php?pbgid=112619&entryid=668870" Then ConsoleWrite("Link found! '" & $oLink.href & "'." & @CRLF) $strLink = $oLink.href ExitLoop EndIf Next ; Wait for the page to load => 10 seconds max _IELoadWaitTimeout(10000) _IENavigate($oIE, $strLink, 1) If @error = 6 Then ; $_IESTATUS_LoadWaitTimeout ConsoleWrite("_IENavigate() = Ok ( $_IESTATUS_LoadWaitTimeout )" & @CRLF) $sHTML = _IEDocReadHTML($oIE) If @error Then ConsoleWrite("_IEDocReadHTML() = Error: " & @error & @CRLF) Else ConsoleWrite("_IEDocReadHTML() = Ok" & @CRLF) ConsoleWrite("START HTML CODE: " & @CRLF & @CRLF & $sHTML & @CRLF & @CRLF & "END HTML CODE" & @CRLF) _IEQuit($oIE) If @error Then ConsoleWrite("_IEQuit() = Error: " & @error & @CRLF) Else ConsoleWrite("_IEQuit() = Ok" & @CRLF) EndIf EndIf ElseIf @error <> 6 Then ConsoleWrite("_IENavigate() = Error: " & @error & @CRLF) Else ConsoleWrite("?????" & @CRLF) EndIf EndIf ConsoleWrite(@CRLF & "END DEBUGGING" & @CRLF) EndIf Edited September 6, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
LeonLai Posted September 6, 2018 Author Posted September 6, 2018 Thank you very much I'll study this code very carefully
LeonLai Posted September 11, 2018 Author Posted September 11, 2018 @FrancescoDiMuro It's still can't get the next page HTML QQ
FrancescoDiMuro Posted September 11, 2018 Posted September 11, 2018 1 minute ago, LeonLai said: It's still can't get the next page HTML QQ Where's your code? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
LeonLai Posted September 11, 2018 Author Posted September 11, 2018 (edited) @FrancescoDiMuro #include <IE.au3> #include <Inet.au3> #include <MsgBoxConstants.au3> $oIE = _IECreate("http://blog.sina.com.tw/bwrbwrbqrthbby/") _IELoadWait($oIE) _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.href = "http://blog.sina.com.tw/bwrbwrbqrthbby/article.php?pbgid=112619&entryid=668870" Then _IEAction($oLink, "click") _IELoadWait($oIE) ExitLoop EndIf Next Sleep(2000) $nIE = _IEAttach("新浪") MsgBox($MB_SYSTEMMODAL, "The URL", _IEPropertyGet($nIE, "locationurl")) _IEQuit($oIE) Sleep(2000) $sHTML = _IEDocReadHTML($oIE) Edited September 11, 2018 by LeonLai
LeonLai Posted September 11, 2018 Author Posted September 11, 2018 @FrancescoDiMuro IF I just use the _IENavigate The page not do anything no end no run on that webpage It's that something protect the website?
FrancescoDiMuro Posted September 11, 2018 Posted September 11, 2018 16 minutes ago, LeonLai said: It's that something protect the website? It could be, but I don't know Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Developers Jos Posted September 11, 2018 Developers Posted September 11, 2018 See code 3 posts up. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
FrancescoDiMuro Posted September 11, 2018 Posted September 11, 2018 1 hour ago, LeonLai said: _IEAction($oLink, "click") _IELoadWait($oIE) Are you still using this? Did you read the example I posted? I gave it to you for a purpose. You don't have to click to the link as I've already told you, but you have to navigate to it. Last message for me in this topic if you keep using this code. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now