Jump to content
Sign in to follow this  
Bensdb

Super Simple _IE navigate problem I have been trying to fix for HOURS

Recommended Posts

Bensdb

Hi - 

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

 

Share this post


Link to post
Share on other sites
Juvigy

Put one IELoadWait after the navigate. If this doesnt help , put IEAttach after that.

 

  • Like 1

Share this post


Link to post
Share on other sites
Bensdb

I have just tried all of the above suggestions to no avail....tried reinstalling newest version of Autoit, tried _IELoadWait after navigate, tried attach before and after navigate....

The problem is the it gets STUCK when on the first navigate in the loop, and NO CODE after that runs....

It's like it is getting stuck, and never finishes loading or something....I've tried having a msgbox after navigate in the loop and it never shows, so it's clear it is just stopping on the page load, and never finishing the navigate action.

Is there a way to navigate to a url other than "navigate"?

Share this post


Link to post
Share on other sites
Bensdb

Interestingly, when I use " Send ( "!d" & $newurl & "{ENTER}" )" to input the url into the address bar programatically, if I put a IELoadWait after it, it will also pause on first page load...if I don't then it runs fine...

So it's something to do with _IENavigates inbuilt pageload thing getting stuck...even when I choose to switch it off in _IENvigate parameters....

Share this post


Link to post
Share on other sites
mikell
21 hours ago, Danp2 said:

Your code ran fine for me.

For me too...
What if you try with tabs ?

#include <IE.au3>

Global Const $navOpenInNewTab = 0x0800
$url = "http://www.jobhero.ph/resume-search/all/"
$oIE = _IECreate($url & "1")
_IELoadWait($oIE)
Sleep(2000)
_Next(5)

Func _Next($a)
   For $i = 2 to $a
       $oIE.Navigate2($url & $i, $navOpenInNewTab, "_top")
      _IELoadWait($oIE)
      Sleep(2000)
  Next
EndFunc

 

  • Like 1

Share this post


Link to post
Share on other sites
Bensdb

tried passing 0 to IEnavigate wait flag and still nothing...Tabs works....

Share this post


Link to post
Share on other sites
mikell
6 hours ago, Bensdb said:

Tabs works....

Please understand that insofar as we can't reproduce your issue it's quite difficult to help you
Did you mean that my previous script runs correctly for you, displaying the wanted pages and so on ?
If so what about this :

#include <IE.au3>

$url = "http://www.jobhero.ph/resume-search/all/"
$oIE = _IECreate($url & "1")
_IELoadWait($oIE)
Sleep(2000)
_Next(5)

Func _Next($a)
   For $i = 2 to 5;$a
       $oIE.Navigate2($url & $i)
      _IELoadWait($oIE)
      Sleep(2000)
  Next
EndFunc

 

Share this post


Link to post
Share on other sites
corgano

What comes to mind immediately is that IE is still loading... and loading, and loading, and loading. However since it works for other people here (me included!) with no issue, it's probably something to do with your IE. Try these steps:

  • If you have any extensions / plugins for IE, disable them!
  • Update IE and get it to as stock settings as you can
  • If any part of your script runs javascript commands on the IE object, disable them (If you don't understand this one then skip it)


Another suggestion is if you have another computer you have access to, try running it on there. IF it works on the second computer and still not your main, there could be some kind of setting in IE or some plugin messing it up. Try to make your computer more like the second computer's IE until both work.


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Mucho
      By Mucho
      Hi,
      I'm trying to navigate down my company's website. I successfully use _IELinkClickByText to open the first link ("Today's Events") which opens a new page with a different address.
      Then I need to click on another link ("Meetings") on this new page to get to my destination but I can't get it right.
      I cannot use _IENavigate as the address link of "Meetings" can change.
      I cannot find any good example on this forum and the web to follow, so I hope someone can help.
      #include <IE.au3> ;Main Page $oIE =_IECreate ("http://abc/xyz/", 0, 1, 1, 1) WinSetState("Report - ABC - Windows Internet Explorer","",@SW_MAXIMIZE) Send("{Enter}") ;Login ; Second Level _WinWaitActivate("ABC Intranet Systems - Windows Internet Explorer","") _IELinkClickByText ($oIE, "Today's Events") ;Click on this link after logging in. ; Third Level _WinWaitActivate("Report - ABC - Windows Internet Explorer","") $oIE = _IEAttach ("Report - ABC - Windows Internet Explorer","", "url") ; I want to click on "Meetings", the addess of which is not constant. _IELinkClickByText ($oIE, "Meetings") #region --- Internal functions Au3Recorder Start --- Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc
    • adamchapman
      By adamchapman
      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       
    • Herb191
      By Herb191
      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[0][0] If _ProcessGetParent($aProc_List[$i][1]) = $pid Then ProcessClose($aProc_List[$i][1]) $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
×