18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Capture Screen
Dear All,
is there any option to capture the running application browser
currently i am using the below code, but here the problem is, it is capturing full desktop.
while running the application, if i open the another window it is capturing that window instead of application browser
For example
i have kept the script and it is running, at the same time i am working with notepad, then instead of capturing the application browser it is capturing the notepad
another problem like while running the scripts, if i have locked the system then it is capturing the black screen, not able to capture the application browser if we were locked the system
here is the code which i have used
var robot = new java.awt.Robot();
var toolkit = new java.awt.Toolkit.getDefaultToolkit();
var screenSize = toolkit.getScreenSize();
var screenRect = new java.awt.Rectangle(0, 0, screenSize.width, screenSize.height);
var image = robot.createScreenCapture(screenRect);
var file = new java.io.File("D:/ART/"+$filename+".png");
javax.imageio.ImageIO.write(image, "png", file);
is there any code like which can capture only the application browser screen even i am in another work
kindly provide the solution if any one knows
Thanks in advance to all
Thanks & Regards,
Siva
is there any option to capture the running application browser
currently i am using the below code, but here the problem is, it is capturing full desktop.
while running the application, if i open the another window it is capturing that window instead of application browser
For example
i have kept the script and it is running, at the same time i am working with notepad, then instead of capturing the application browser it is capturing the notepad
another problem like while running the scripts, if i have locked the system then it is capturing the black screen, not able to capture the application browser if we were locked the system
here is the code which i have used
var robot = new java.awt.Robot();
var toolkit = new java.awt.Toolkit.getDefaultToolkit();
var screenSize = toolkit.getScreenSize();
var screenRect = new java.awt.Rectangle(0, 0, screenSize.width, screenSize.height);
var image = robot.createScreenCapture(screenRect);
var file = new java.io.File("D:/ART/"+$filename+".png");
javax.imageio.ImageIO.write(image, "png", file);
is there any code like which can capture only the application browser screen even i am in another work
kindly provide the solution if any one knows
Thanks in advance to all
Thanks & Regards,
Siva
This discussion has been closed.
Comments
I m using xvfb to run Sahi on a virtual display, though capture and replay works on my visible display, suites get captured on the virtual screen. Unfortunately, it wont work with windows. If you are working with Unix systems, you can check out the link in my signature below to get the needed code.
Regards
Wormi
Thank you for reply
i am not able to understand what are you saying.
the code which i have used (which i have shown above) is capturing the whole desktop only if the running application browser is on top (focus)
but i want the code like which can capture only the running application browser screen even i am in another work or when lock the system
if you know the solution please post the code
Thank you once again
kindly let me know is there solution for this solution in sahi.
Thanks and Regards,
Siva
is there solution for this problem in sahi ?
if there is solution for this problem, requesting you folks kindly let me know solution
Thanks in advance
Thanks & Regards,
Siva
I can provide some code, which won't capture a specified window, but it will be possible to let your suites run on another virtual display, where the browser will be always on top. So the steps are: start sahi on a virtual display, run your suite on that display, take screenshots of that display. This won't interfere with any work on your visible display. I will gladly answer any questions regarding the code and how to implement it.
Sahi screenshot function:
http://paste.robbi5.com/4b9a8462.txt
This code will execute a shell script and can't be used on windows systems!
The shellscript:
http://paste.robbi5.com/5746f4b1.txt
requires imagemagick!
This code is meant to be used with xvfb, guide here:
http://wiredworm.blogspot.com/2011/02/running-sahi-testsuites-on-server-unix.html
Thank you for your reply.
i am not able to understand the code and how to use this code to capture the screen.
my application is running in windows operating system, in my organization we are using only windows operating system, we don't have unix.
if you know the code for windows operating system, kindly post the code.
Thanks in advance
Thanks & Regards,
Siva
is there solutions for this problem in sahi ?
please do let me know whether is there solution for this in sahi or do we need to go for another automation tool for this option
Thanks in advance
Thanks & Regards,
Siva
You can use SnapsIE (IE) or ScreenGrab (FF) plugins and may be invoke them from Sahi.
There are no solutions which are cross platform and cross browser to take screen shots of just the browser content. If you are confined to one browser, you could use some browser plugin to make it work for you.
For a cross platform solution, you can try Sahi Pro's _takeSnapShot API which will resize the window correctly, scroll through the full page and give you screen shots of the full page.
Regards,
Narayan
Thank you very much for ur information narayan .
Thanks & Regards,
Siva