Jump to content

Scroll Web Browser Window Seamlessly


Recommended Posts

Hi,

I am new to AutoIt.

I want to scroll browser window with proper scrolling location.

I mean following src I created scrolls.

And, say the web content between following scroll locations has invisible content between the 2 location since y=0 to 500 is a big jump. I want it to scroll more seamlessly. Could you help me on this?

1. First : $oIE.document.parentwindow.scroll(0,0)

2. Next: $oIE.document.parentwindow.scroll(0,500)

Scenario:

1. Open URL like http://www.yahoo.com/ with browser (IE8) manually.

2. Run the following src.

#Include <IE.au3>
WinActivate("[CLASS:IEFrame]")
WinMove("[CLASS:IEFrame]", "", 0, 0)
$sURL = ControlGetText("[CLASS:IEFrame]", "", "Edit1")
$oIE = _IEAttach($sURL, "url")
$oBody = $oIE.document.body
$oHtml = $oIE.document.documentElement
$Width = $oBody.scrollWidth
$Height = $oHtml.scrollHeight
;Set Browser Width and Height
$oIE.width = $Width + 100
$oIE.height = 500 ; force Browser window height
; Scroll to Top
$oIE.document.parentWindow.scroll(0,0)
$cnt = Ceiling($Height / 500)
For $i = 1 to $cnt
sleep(2000)
$scrollHeight = $i * 500
$oIE.document.parentWindow.scroll(0,$scrollHeight)
Next

Please, let me now if you have any question!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...