Bensdb Posted October 19, 2017 Posted October 19, 2017 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
Juvigy Posted October 19, 2017 Posted October 19, 2017 Put one IELoadWait after the navigate. If this doesnt help , put IEAttach after that. Bensdb 1
Danp2 Posted October 19, 2017 Posted October 19, 2017 Your code ran fine for me. Are you using the latest version of AutoIt? Bensdb 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
Bensdb Posted October 20, 2017 Author Posted October 20, 2017 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"?
Bensdb Posted October 20, 2017 Author Posted October 20, 2017 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....
Danp2 Posted October 20, 2017 Posted October 20, 2017 Change your _IENavigate line to include the $iWait parameter. Passing a zero here will return without waiting. Latest Webdriver UDF Release Webdriver Wiki FAQs
mikell Posted October 20, 2017 Posted October 20, 2017 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 Bensdb 1
Bensdb Posted October 20, 2017 Author Posted October 20, 2017 tried passing 0 to IEnavigate wait flag and still nothing...Tabs works....
mikell Posted October 20, 2017 Posted October 20, 2017 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
Danp2 Posted October 20, 2017 Posted October 20, 2017 What OS? What version of IE? Latest Webdriver UDF Release Webdriver Wiki FAQs
corgano Posted October 20, 2017 Posted October 20, 2017 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
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