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.
sahi as a windows service?
I've configured sahi to be a windows service. Everything works fine except I can't run the ant task sahi test via the service. What could possibly be the reason?
I've checked the log information and it shows the location of the properties files and user properties files and OS properties files. Normal as I started it from the batch file. I can also use CTRL-ALT-DblClick to open a Sahi window. I can access localhost:9999. It just looks fine.
But when I use ant command to run the sahi test it stops at the sahi task and never opens the browser. It works when I turn off the service and use sahi/userdata/bin/start_sahi.bat to start sahi manually.
I've checked the log information and it shows the location of the properties files and user properties files and OS properties files. Normal as I started it from the batch file. I can also use CTRL-ALT-DblClick to open a Sahi window. I can access localhost:9999. It just looks fine.
But when I use ant command to run the sahi test it stops at the sahi task and never opens the browser. It works when I turn off the service and use sahi/userdata/bin/start_sahi.bat to start sahi manually.
Comments
If you start IE8 from a service (Sahi), the browser will also run as a service (without UI).
This may or may not work properly. We can check and update you.
It would be great if you could tell us how you start Sahi as a service, so that it is easy for us to replicate and confirm.
Thanks,
Narayan
run command from DB2 command prompt, as it returns the control back to ANT
schtasks /run /tn sahi
schtasks /end /tn sahi
ANT targets which you can use as -
<target name="start-sahi" description="Starts Sahi Server">
<!-- Using DB2CMD as it returns the control back to ant -->
<echo/>
<echo message="Starting Sahi"/>
<echo/>
<exec executable="cmd" failonerror="true">
<arg value="/c" />
<arg value="schtasks /run /tn sahi" />
</exec>
</target>
<target name="stop-sahi" description="Stop Sahi Server">
<exec executable="cmd" failonerror="true" dir="${sahidir}/bin">
<arg value="/c" />
<arg value="schtasks /end /tn sahi" />
</exec>
</target>
Let me know if this helps you.
Regards,
Sumeet
I use java service wrapper to start sahi as a service. If the browser is run as a service without UI at least it should kill the process after the test is done.
Thank you for your reply. Your scripts are very helpful. I can start and stop sahi from ant now. For one sahi test it is OK to use the script but if I want to run multiple sahi tests which are started by different projects I will end up starting many sahi services simultaneously. This script is nice but not an ideal option for my situation. I still prefer using the windows service if it can work properly.
This is the behavior I observed:
With "Allow service to interact with desktop", both IE and Firefox run visibly.
Without "Allow service to interact with desktop", firefox runs without being visible, but IE does not work at all.
Firefox took the same amount of time whether it was visible or not.
Thanks Sumeet for the schtasks tip.
Thank you. I've checked "Allow service to interact with desktop" yesterday and it was working fine on my Windows XP. But I couldn't tell you another problem that I was facing yesterday because the forum was down.
Although the service works on windows XP, I am never able to make it work on Windows Server 2003, where my test scripts will be. I checked "Allow service to interact with desktop" on windows server 2003 but nothing happened. I used an ant task to test if sahi is working. It will stop at the sahi ant task until it reported failure several minutes later.
FYI, I'm using Java 1.6.0_17 and ant 1.8 running ant task.
IE version is IE8.
Settings are the same on windows XP and windows server 2003 and I have full administrator rights on the server.