www.teamdev.com
0 Replies Last post: Jul 31, 2008 6:20 PM by kengentry5001  
Click to view kengentry5001's profile   3 posts since
Jul 31, 2008

Jul 31, 2008 6:20 PM

Child window sizing and crash on screen capture


I am using JExplorer 1.9, Windows XP Pro, IE7, JDK 1.5.0_14 and Adobe Acrobat Reader v8.0.

My browser automation app clicks a link to a PDF file. A new child window pops up that needs to be resized (can't even see any content). I want to resize the window so the PDF is viewable and then take a screenshot. When I resize the window using:
child.getgetTopLevelAncestor().setBounds(0, 0, 1000, 800);

The resize works but the window does not repaint the PDF content - just get a gray colored empty window. I tried adding a child.refresh() but it didn't work. If I put in a sleep after the child pops up I can manually resize the window and it repaints the PDF properly. Is there a way to specify a window size for children BEFORE they are opened? This would be very helpful rather than resizing after the window is opened.

Another problem is I get a NullPointerException when I try to take a screenshot of this window:

Exception in thread "main" java.lang.NullPointerException
at com.jniwrapper.win32.ie.dom.e.getElementsByTagName(SourceFile:233)
at com.jniwrapper.win32.ie.dom.e.b(SourceFile:461)
at com.jniwrapper.win32.ie.dom.e.getBody(SourceFile:479)
at com.jniwrapper.win32.ie.dom.e.c(SourceFile:528)
at com.jniwrapper.win32.ie.dom.e.getHorisontalScrollPosition(SourceFile:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.jniwrapper.win32.ie.dom.j.run(SourceFile:592)
at com.jniwrapper.win32.MessageLoopThread$ThreadSynchronizedAction.run(MessageLoopThread.java:569)
at com.jniwrapper.win32.MessageLoopThread$LoopThread.run(MessageLoopThread.java:511)

Any help you can provide to get this working would be greatly appreciated.