7 posts in this topic
I am simply trying to loop through pages of a website using _IENavigate..
For some reason it freezes on page 2, rather than continuing through the loop.
I have been trying to fix this for hours and I am really at the end of my tether with it...
Any experienced Autoit'ers fancy having a bash for me?
I've tried sleep, messing with the IE.au3 file, rewriting the whole script to try to target the link after the active link in the nav menu....EVERYTHING.
Just a beginner who is thoroughly stuck after hours of trying.
#include <MsgBoxConstants.au3> #include <IE.au3> #include <Array.au3> #include <File.au3> Global $oIE = _IECreate("http://www.jobhero.ph/resume-search/all/1") For $i = 2 To 5 ; THIS IS WHERE AUTOIT LOSES THE CONNECTION TO BROWSER AFTER ~2-3 URLS sleep(4000) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< added this to give time between navigations _IENavigate($oIE, "http://www.jobhero.ph/resume-search/all/" & $i) If @error Then MsgBox(0, "Error", "There was a problem opening webpage!") EndIf Next
Guys need help, why second _IELinkClickByText not working ? First click is ok, but second click is problem.
Warning from function _IELinkClickByText, $_IESTATUS_NoMatch but text is correct.
First click, changed browser adress is this a problem ?
Thanks for answer.
Func zmazanie() $oIE = _IECreate("http://www.bazos.sk/moje-inzeraty.php/") $cozmazat = GUICtrlRead($nadpis) Sleep (2000) _IELinkClickByText($oIE, $cozmazat) Sleep (2000) _IELinkClickByText($oIE, "Zmazať/ Editovať/ Topovať") EndFunc
I'm trying to get table data from a webpage that needs to be navigated to. I am currently using _IECreate to create an IE object, then using some more code to login to the site. After login is confirmed, I need to navigate to another page and get table data from it.
My code looks like this:
$oIE = _IECreate("url") ; run login script _IENavigate($oIE,"https://.....tablepage") $oTable = _IETableGetCollection($oIE) ConsoleWrite("oTable = " & $oTable & @CRLF) ConsoleWrite("oTable error = " & @ERROR) The object $oTable appears to be empty, and an object type error is returned.
The messages written into the console are:
oTable = oTable error = 0--> IE.au3 V2.4-0 Error from function _IETableWriteToArray, $_IEStatus_InvalidObjectType I'm not entirely sure that the _IENavigate function updates the $oIE object, so that might be a source of problems. The tables on the navigated page are of the normal html type, beginning with <table id=...>, so I don't think the page syntax is an issue. Any help is greatly appreciated
i have a trouble, maybe someone will can help me?
ArchoTag of the link:
Extra Information: Link Text: Link 31
Obj Type: DispHTMLAnchorElement
I think there is 3 solutions:
By clicking the dynamic text "Link 2 or Link 123 or Link n"
Or by using _IETagNameGetCollection, i don't know how to use this function to open link
Now i try it, but IELinkClickByText don't click on A tag link:
$oElements = _IETagNameGetCollection($oIE,"A") $text = "" For $oElement In $oElements StringRegExp($oElement.innerText, "Link") If not @error then $text = $oElement.innerText Next _IELinkClickByText($oIE,$text)
Any tips pls how to open this link.
EDIT: Fix CODE.
I use a lot of IE functions in my scripts and find it really annoying when I try to use _IENavigate to leave a webpage and I get popups saying things like "Are you sure you want to leave this page?". I searched the forum and could not find a solution that I liked so I created this function. I hope others find it useful and as always I am open to any constructive criticism (that's how we learn).
_ProcessGetParent() function taken from MrCreatoR's post (thanks MrCreatoR)
#include <IE.au3> ;This page currently has displays a popup when you try to navigate away from the page $any_url = "aquaponics4you.com" ;$any_url = "yahoo.com" $oIE = _IECreate($any_url) $oIE = _IENavigate_kill_popup($oIE, "Google.com") Func _IENavigate_kill_popup($IEObject, $URL, $visible = 1, $wait = 1) If Not IsObj($IEObject) Then Return SetError(1, 0, 0) $closed_process = False ;gets the IE process $pid = WinGetProcess(_IEPropertyGet($IEObject, "hwnd")) ;Trys to navigate to URL _IENavigate($IEObject, $URL, 0) ;Gets list of all process $aProc_List = ProcessList() ;Checks to see if any process were opened by the IE window. If process where opened it closes them and the IE window. For $i = 1 To $aProc_List If _ProcessGetParent($aProc_List[$i]) = $pid Then ProcessClose($aProc_List[$i]) $closed_process = True EndIf Next ;will create a new IE with old IE object varable if it no longer exists. If $closed_process = True Then $IEObject = _IECreate($URL, 0, $wait) Return $IEObject Else If $wait = 1 Then _IELoadWait($IEObject) Return $IEObject EndIf EndFunc ;==>_IENavigate_stop_pop Func _ProcessGetParent($iPID) Local $wbemFlagReturnImmediately = 0x10 Local $wbemFlagForwardOnly = 0x20 Local $colItems = "" Local $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Process", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems If $objItem.ProcessID = $iPID Then Return $objItem.ParentProcessID Next EndIf Return SetError(1, 0, 0) EndFunc ;==>_ProcessGetParent