Jump to content

measure lenth of a webpage?


neo007
 Share

Recommended Posts

Hi all,

I'm working on a script about a website. This website has many pages that are named by numbers. All pages are the same length. My script will navigate pages one by one and read the text of each.

The problem is, some pages show 0 text, you have to refresh several times to fix it. In this case, there's no slider at right hand.----Normally the slider is the same length for these pages( = pagedown twice).

So, I want to check every page's slider length and then decide whether to refresh.

I checked the help file, found nothing.

I noticed that there's a :

#Include <GuiSlider.au3>

_GUICtrlSlider_GetThumbLength($hWnd)

But I used Au3info.exe, can not find any slider object in an IE window, so can not get "$hWnd".

Any idea, please?

Thanks.

Edited by neo007
Link to comment
Share on other sites

Perhaps _IEPropertyGet and get the height of the BODY object.

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

Link to comment
Share on other sites

Look at this example:

$oIE = _IE_Example("form")

$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oTextArea = _IEFormElementGetObjByName($oForm, "textareaExample")

; Get coordinates and dimensions of the textarea
$iScreenX = _IEPropertyGet($oTextArea, "screenx")
$iScreenY = _IEPropertyGet($oTextArea, "screeny")
$iBrowserX = _IEPropertyGet($oTextArea, "browserx")
$iBrowserY = _IEPropertyGet($oTextArea, "browserY")
$iWidth = _IEPropertyGet($oTextArea, "width")
$iHeight = _IEPropertyGet($oTextArea, "height")

; Outline the textarea with the mouse, come to rest in the center
MouseMove($iScreenX, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY)
MouseMove($iScreenX + $iWidth/2, $iScreenY + $iHeight/2)
Link to comment
Share on other sites

And you'll see that the _IEPropertyGet value returns the same answer as big_daddy's solution:

#include <IE.au3>

$oIE = _IEAttach("autoit")
$oBody = _IETagNameGetCollection($oIE, "BODY", 0)
ConsoleWrite("scrollHeight: " & $oBody.scrollHeight & @CR)
ConsoleWrite("Body Height: " & _IEPropertyGet($oBody, "height") & @CR)

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

Link to comment
Share on other sites

  • Moderators

And you'll see that the _IEPropertyGet value returns the same answer as big_daddy's solution:

Dale

Are you sure?

#include <IE.au3>

$oIE = _IE_Example("form")
$hWnd = _IEPropertyGet($oIE, "hwnd")
$oBody = _IETagNameGetCollection($oIE, "BODY", 0)

ConsoleWrite("scrollHeight: " & $oBody.scrollHeight & @CR)
ConsoleWrite("Body Height: " & _IEPropertyGet($oBody, "height") & @CR)

WinSetState($hWnd, "", @SW_MAXIMIZE)

ConsoleWrite("scrollHeight: " & $oBody.scrollHeight & @CR)
ConsoleWrite("Body Height: " & _IEPropertyGet($oBody, "height") & @CR)
Link to comment
Share on other sites

And you'll see that the _IEPropertyGet value returns the same answer as big_daddy's solution:

#include <IE.au3>

$oIE = _IEAttach("autoit")
$oBody = _IETagNameGetCollection($oIE, "BODY", 0)
ConsoleWrite("scrollHeight: " & $oBody.scrollHeight & @CR)
ConsoleWrite("Body Height: " & _IEPropertyGet($oBody, "height") & @CR)

Dale

You two have made this point more clear for me.

I tried your code, (I didn't use "autoit"), the result:

scrollHeight: 695

Body Height: 886

In this set of pages, only the last one is short, and if there's net problem, the content of a page seems to be zero, I have to refresh......otherwise all pages seem to be the same length.

With more test I find out that different pages have the same body height(886), even if it's the last page. But scrollheight of the last page is short.

Edited by neo007
Link to comment
Share on other sites

Are you sure?

Can't argue with that! How curious... my example attaching to the AutoIt forum webpage did in fact return identical values.

There are a whole bunch of these measurement properties and they are all over the board between different browsers and versions.

I like big_daddy's suggestion the best.

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...