alexandruc Posted November 13, 2015 Share Posted November 13, 2015 (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 November 13, 2015 by alexandruc spelling corrections Link to comment Share on other sites More sharing options...
czardas Posted November 13, 2015 Share Posted November 13, 2015 (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 November 13, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
alexandruc Posted November 13, 2015 Author Share Posted November 13, 2015 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. Link to comment Share on other sites More sharing options...
czardas Posted November 13, 2015 Share Posted November 13, 2015 (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.EditIt 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 November 13, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
alexandruc Posted November 16, 2015 Author Share Posted November 16, 2015 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. Link to comment Share on other sites More sharing options...
alexandruc Posted November 24, 2015 Author Share Posted November 24, 2015 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 czardas and argumentum 2 Link to comment Share on other sites More sharing options...
czardas Posted November 24, 2015 Share Posted November 24, 2015 (edited) Excellent. Thank you for sharing your solution. Edit : Quite clever! Edited November 24, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
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