Sign in to follow this  
Followers 0
tinygreypixel

IENavigate weird behaviour

11 posts in this topic

Hi!

I have a code that makes some automated tasks on a web page, and i use _IENavigate() to change url on the site. I've the noticed that the code works fine on my comp with WinXP SP2 and IE6, but it have some problems when running on another computer with IE7. It seems like _IENaviget() opens a cached old version of the page. Site has dynamic content of course.

An example:

1. _IENavigate opens an url

2. _IENavigate opens another page on the same site

3. _IENavigate opens the the first url again, but the page displayed is an old version (didn't refresh as it should be)

I also tried the alternate __IENavigate($objie, $url, 4) function, which should use navigation without caching, but it didn't work.

Any idea to resolve this problem?

Share this post


Link to post
Share on other sites



Please double-check interaction in IE manually to insure you are seeing different behaviour and then post a simple reproducer.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Please double-check interaction in IE manually to insure you are seeing different behaviour and then post a simple reproducer.

Dale

I checked it again, and wrote a simple reproducer, the code is here:

#include "IE.au3"


$ObjIE = ObjCreate("InternetExplorer.Application")
$ObjIE.visible = True

GotoLink($ObjIE, "http://blaise.no-ip.org/time.php")
MsgBox(4096, "Debug info", "'" & _IEBodyReadHTML($ObjIE) & "'")
;Sleep(1000)
GotoLink($ObjIE, "http://blaise.no-ip.org/clean.php")
MsgBox(4096, "Debug info", "'" & _IEBodyReadHTML($ObjIE) & "'")
GotoLink($ObjIE, "http://blaise.no-ip.org/time.php")
MsgBox(4096, "Debug info", "'" & _IEBodyReadHTML($ObjIE) & "'")


$ObjIE.Quit
$ObjIE = 0; remember to free component

Exit

Func GotoLink($ObjIE, $url)
    Do
    ;$res = _IENavigate($ObjIE, $url)
        $res = __IENavigate($ObjIE, $url, 4); reads without caching?
        $err = @error
        If $err <> 0 Then
            Sleep(1000)
            _IEAction($ObjIE, "refresh")
        EndIf
    Until $err = 0
    Return $res
EndFunc

It just opens a page that shows current date and time, then goes on a blank page, then back on the first page. You can see that is shows the same time as first time, but if i open the page manually, it works.

Share this post


Link to post
Share on other sites

I get the same result when I visit the page manually, so it is something unique you have set up on your system for manual browsing, not something wrong with _IENavigate. (btw, I had to fix the __IENavigate call to add a missing $f_wait parameter: __IENavigate($ObjIE, $url, 1, 0x4) )

I pasted http://blaise.no-ip.org/time.php into the address bar, then clicked my Home button and then again pasted http://blaise.no-ip.org/time.php into the address bar and got the same date and time. I even tried an old trick of adding a bookmark to the end of the URL like this: http://blaise.no-ip.org/time.php#45 and still got the old page.

Any idea why your results are different than mine?

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I get the same result when I visit the page manually, so it is something unique you have set up on your system for manual browsing, not something wrong with _IENavigate. (btw, I had to fix the __IENavigate call to add a missing $f_wait parameter: __IENavigate($ObjIE, $url, 1, 0x4) )

I pasted http://blaise.no-ip.org/time.php into the address bar, then clicked my Home button and then again pasted http://blaise.no-ip.org/time.php into the address bar and got the same date and time. I even tried an old trick of adding a bookmark to the end of the URL like this: http://blaise.no-ip.org/time.php#45 and still got the old page.

Any idea why your results are different than mine?

Dale

I've tried again and it works like as it worked for you, it's not refreshing the time only if I hit the refresh button. The browser seems to simply cache the page, I checked the webserver's log files.

But __IENavigate($ObjIE, $url, 1, 0x4) should still work, right? Is there a way to force the browser to load the page again, without using _IEAction($ObjIE, "refresh")? This one works but it's slow because it's also reloading all images on the page.

Edited by tinygreypixel

Share this post


Link to post
Share on other sites

I've tried again and it works like as it worked for you, it's not refreshing the time only if I hit the refresh button. The browser seems to simply cache the page, I checked the webserver's log files.

But __IENavigate($ObjIE, $url, 1, 0x4) should still work, right? Is there a way to force the browser to load the page again, without using _IEAction($ObjIE, "refresh")? This one works but it's slow because it's also reloading all images on the page.

A description of the flags can be found here: http://msdn2.microsoft.com/en-us/library/a...360(VS.85).aspx

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

A description of the flags can be found here: http://msdn2.microsoft.com/en-us/library/a...360(VS.85).aspx

Dale

Thanks, I've tried using __IENavigate with navNoWriteToCache flag and it works in the reproducer code but not with the original page. :S

I mean, replacing __IENavigate($ObjIE, $url, 1, 0x4) with __IENavigate($ObjIE, $url, 1, 0x8) solved the problem in the case of the reproducer code, it displays current time both time, both on IE6 and IE7, but when I use the same code with the original page, it still gives cached page at second query on IE7. I don't know why does IE7 behave other way than IE6 does, nor do I know how to write another reproducer, I guess I'll avoid using IE7 for now and use IE6 instead.

Thank you for your help, and I wish you a Happy New Year! :)

Share this post


Link to post
Share on other sites

If you want to take it further, I'd suggest that you look at the HTTP interaction using DebugBar (or Fiddler if you really want to dig into it). Beyond that, rewrite your reproducer in VBScript and take it over to the MSDN community forums for more discussion.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

More: if you Google navNoReadFromCache you'll find lots of complains about it not working... bummer. I confirmed this in DebugBar.

Also, I remembered that the trick I told you about above that I used to use was wrong... passing a bogus bookmark does not trigger a new read, but passing a bogus query string does... so, unless the target page is parsing a query string that you would screw up with this method, you can:

_IENavigate($oIE, "http://blaise.no-ip.org/time.php" & "?" & Random(1000, 9999))

and it should retrieve a new page each time.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

More: if you Google navNoReadFromCache you'll find lots of complains about it not working... bummer. I confirmed this in DebugBar.

Also, I remembered that the trick I told you about above that I used to use was wrong... passing a bogus bookmark does not trigger a new read, but passing a bogus query string does... so, unless the target page is parsing a query string that you would screw up with this method, you can:

_IENavigate($oIE, "http://blaise.no-ip.org/time.php" & "?" & Random(1000, 9999))

and it should retrieve a new page each time.

Dale

Thanks for the tip Dale. :) I figured something out today. I've uninstalled IE7 on that comp, because I thought the script will work with IE6. But the page didn't refresh with IE6 on that machine! I guess the problem is that it's connecting through a proxy server. But I still don't know what's the difference between clicking the link manually and using _IENavigate(), when I click the link it does refresh the page.

Share this post


Link to post
Share on other sites

But you said...

I've tried again and it works like as it worked for you, it's not refreshing the time only if I hit the refresh button

so it works the same way via script and mouse right?

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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  
Followers 0