I use Imager::Screenshot in my Perl code and it does work and takes the screenshot.
Now, every time the browser opens in different position, meaning starting x and y positions might not be the same.
Is there a way to screenshot starting from the browser instead of the desktop starting position.
And if not (kind of off topic from programming) is there a way to set the browser open only in full size, no matter what program its opened from. Opened by user when clicked on the icon, or opened by Perl using Win32::OLE module.
You can use Win32::GuiTest::FindWindowLike to find the window handle associated with the browser and specify that to
screenshot:The code above will take separate screenshots for the overall IE window and the child window that holds the current tab. If you are only interested in top level IE windows, you’d want to use
my @windows = FindWindowLike(0, 'Internet Explorer', '^IEFrame');In addition, if you have opened an “InternetExplorer.Application” window using
Win32::OLE, you can access the object’s Top, Height, and Width properties to determine its location and area. In addition, you can get its HWND so that you can set it as the foreground window.Alternatively, using OLE events: