alexandruc

Scroll overflowing <div> in IE

7 posts in this topic

#1 ·  Posted (edited)

Hello,

Is it possible to send scroll-up/scroll-down commands to an overflowing <div> inside a web page?

Right now I am using focus on the respective <div> and then I send {PGUP} / {PGDN} commands.

The problem with this approach is the changing focus that prevents anyone to use the desktop while the scripts are running.

Is there another way to programmatically target the div and make it scroll (up or down) thus allowing the script to run in the background?

Thank you.

 

 

 

Edited by alexandruc
spelling corrections

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Have you looked at the IE functions in the help file? The question is - what are you trying to achieve by scrolling? You might be able to achieve what you want by simply reading the html directly and extracting the relevant information. Are you interacting with elements contained within the <div> or just extracting data?

Edited by czardas

Share this post


Link to post
Share on other sites

Have you looked at the IE functions in the help file? The question is - what are you trying to achieve by scrolling? You might be able to achieve what you want by simply reading the html directly and extracting the relevant information. Are you interacting with elements contained within the <div> or just extracting data?

Yes, I did read the IE functions help file. I don't think I missed any of the applicable ones.

I am extracting data from inside the div (reading everything I find there). The div contains log entries. Scrolling up the div loads older entries into the div so reading simply the HTML will not load all relevant entries and scrolling up (or paging up as I am doing now but it blocks the desktop until the script ends) is necessary to load older not into view entries.

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I'm not sure how to do this: I seldom use Internet Explorer. I would have thought you could send the command to the server (to reload the page with new data) without having to use key strokes. Interesting problem - I hope someone has the solution because I'd also like to know the answer.

Edit
It might help if you were to post a link to the page - or a sample of the html. IEAction() has the option 'scrollintoview'. I'm not sure if this useful.

Edited by czardas

Share this post


Link to post
Share on other sites

I cannot link to the page as it's a secure internal admin page.

Also the HTML is useless: it's just a div containing other nested divs. There is a javascript that detects pageup and scrollup events and loads data (nested divs) into the overflowing div.

I seen the 'scrollintoview' function, but it's useless since the div will not load other data unless it is paged or scrolled up. There is no element hidden from view that I can use to bring into focus.

Share this post


Link to post
Share on other sites

To whoever might be interested, I found a solution:

I used _IEDocInsertHTML with "afterbegin" to insert a <div id=x> at the top of the overflowing <div>. Then I used _IEAction with "scrollintoview" to simulate the pageup/scrollup and load the div.

For $i = 1 To 20
        _IEDocInsertHTML($theOverFlowingDiv, "<div id='scrolltome"&$i&"'></div>", "afterbegin")
        $scrollto = _IEGetObjById($theOverFlowingDiv, "scrolltome"&$i)
        _IEAction($scrollto, "scrollintoview")
        Sleep(4000)
Next

:D

 

2 people like this

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Excellent. Thank you for sharing your solution. :)

Edit : Quite clever!

Edited by czardas

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