18 January 2026:


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.

java.io.FileNotFoundException: D:\Bhaskar_8598\JAVA\config\sahi.proper

bhaskar_pallebhaskar_palle Members
edited November -1 in Sahi - Open Source
Hi,

My apllication is failing to read sahi.props & userdata.props. it is throwing

***java.io.FileNotFoundException: D:\Bhaskar_8598\JAVA\config\sahi.properties.***
*** The system cannot find the path specified***

also give me steps to setup it to the projects classpath

OS: WinXP
Browser: firefox 4
Sahi build: 25-05-2011

Please help me in this..Faster solution is very much appreciated..

Comments

  • Hi bhaskar_palle,

    Can you let me where is Sahi installed.

    Also, can you post the console contents once you start Sahi.

    Regards
    Sumitra
  • Hi Sumitra,

    Sahi is installed in: C:\Program Files\SAHI

    Console is showing below while starting Sahi:


    D:\Bhaskar_8598\JAVA>cd /d C:\Program Files\SAHI\bin\
    SAHI_HOME: ..
    SAHI_USERDATA_DIR: ..\userdata
    SAHI_EXT_CLASS_PATH:
    Sahi properties file = C:\Program Files\SAHI\config\sahi.properties
    Sahi user properties file = C:\Program Files\SAHI\userdata\config\userdata.properties
    Added shutdown hook.
    >>>> Sahi started. Listening on port: 9999
    >>>> Configure your browser to use this server and port as its proxy
    >>>> Browse any page and CTRL-ALT-DblClick on the page to bring up the Sahi Controller
    Reading browser types from: C:\Program Files\SAHI\userdata\config\browser_types.xml
    Firefox 4 was not found at C:\Program Files\Mozilla Firefox 4.0 Beta 7\firefox.exe
    Safari was not found at C:\Program Files\Safari\Safari.exe
    Chrome was not found at $LOCALAPPDATA\Google\Chrome\Application\chrome.exe
    Opera was not found at C:\Program Files\Opera\opera.exe


    While running the test it is showing in the console as below:

    Sahi properties file = D:\Bhaskar_8598\JAVA\config\sahi.properties
    Sahi user properties file = D:\Bhaskar_8598\JAVA\Sahi\config\userdata.properties
    java.io.FileNotFoundException: D:\Bhaskar_8598\JAVA\config\sahi.properties (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at net.sf.sahi.config.Configuration.loadProperties(Configuration.java:121)
    at net.sf.sahi.config.Configuration.init(Configuration.java:95)
    at net.sf.sahi.config.Configuration.initJava(Configuration.java:145)
    at in.co.sahi.JavaClientTest.setUp(JavaClientTest.java:19)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Sahi properties file = D:\Bhaskar_8598\JAVA\config\sahi.properties
    Sahi user properties file = D:\Bhaskar_8598\JAVA\Sahi\config\userdata.properties
    java.io.FileNotFoundException: D:\Bhaskar_8598\JAVA\config\sahi.properties (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at net.sf.sahi.config.Configuration.loadProperties(Configuration.java:121)
    at net.sf.sahi.config.Configuration.init(Configuration.java:95)
    at net.sf.sahi.config.Configuration.initJava(Configuration.java:145)
    at in.co.sahi.JavaClientTest.setUp(JavaClientTest.java:19)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  • Hi bhaskar_palle,

    Can you let me know how did you execute the test?

    Here are the steps to run a test:

    1) Click on the “Bin” link on the Sahi Dashboard

    2) Execute testrunner.bat
    Example:
    testrunner.bat demo/demo.suite http://sahi.co.in/demo/ firefox

    Also, let me know if you are getting any error while executing the test .

    Regards
    Sumitra
  • Hi Sumitra,

    My test is failing to run script. The browser is getting opened and immediately it is getting
    shutdown. In console i am getting the following output:


    D:\Bhaskar_8598\JAVA>cd /d C:\Program Files\SAHI\bin\
    SAHI_HOME: ..
    SAHI_USERDATA_DIR: ..\userdata
    SAHI_EXT_CLASS_PATH:
    Sahi properties file = C:\Program Files\SAHI\config\sahi.properties
    Sahi user properties file = C:\Program Files\SAHI\userdata\config\userdata.properties
    Added shutdown hook.
    >>>> Sahi started. Listening on port: 9999
    >>>> Configure your browser to use this server and port as its proxy
    >>>> Browse any page and CTRL-ALT-DblClick on the page to bring up the Sahi Controller
    Reading browser types from: C:\Program Files\SAHI\userdata\config\browser_types.xml
    Firefox 4 was not found at C:\Program Files\Mozilla Firefox 4.0 Beta 7\firefox.exe
    Safari was not found at C:\Program Files\Safari\Safari.exe
    Chrome was not found at $LOCALAPPDATA\Google\Chrome\Application\chrome.exe
    Opera was not found at C:\Program Files\Opera\opera.exe
    Sep 6, 2011 3:25:43 PM net.sf.sahi.ssl.SSLHelper getKeyManagerFactoryForRemoteFetch
    INFO: No SSL Client Cert specified
    Sep 6, 2011 3:25:43 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_58f743d40d62d044070b91d0a0c63580c885__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 3:25:45 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [5292]; 2344 ms
    Sep 6, 2011 3:25:46 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [5292]
    Sep 6, 2011 3:25:47 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_45f30e02076560481c0af7c02d5e56a6aea8__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 3:25:52 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [5604]; 4906 ms
    Sep 6, 2011 3:25:52 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [5604]
    Sep 6, 2011 4:19:59 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_6ec663c60af850491f09d190cfb31e4a0ff4__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 4:20:04 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [4960]; 5610 ms
    Sep 6, 2011 4:20:04 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [4960]
    Sep 6, 2011 4:20:06 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_ecece614075aa046e4099da0f536e9565879__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 4:20:10 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [788]; 4562 ms
    Sep 6, 2011 4:20:10 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [788]
    Sep 6, 2011 4:29:49 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_a416573d0e89904d7308623015119e7a920c__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 4:29:54 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [3080]; 5063 ms
    Sep 6, 2011 4:29:54 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [3080]
    Sep 6, 2011 4:29:55 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_dfb3f6fe0797e0447a0b28800b43749dc324__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 4:30:00 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [720]; 4719 ms
    Sep 6, 2011 4:30:00 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [720]
    Sep 6, 2011 4:52:01 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_4271308202e5804d360a4e903632d83b64ed__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 4:52:05 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [1760]; 4906 ms
    Sep 6, 2011 4:52:05 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [1760]
    Sep 6, 2011 4:52:07 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_ff5d3404068240474b0bc840da32f6a7ba2d__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 4:52:11 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [5000]; 4734 ms
    Sep 6, 2011 4:52:12 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [5000]
    Sep 6, 2011 4:58:29 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_224226070252e0476f0a0880cf6720b9489f__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 4:58:34 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [4164]; 5156 ms
    Sep 6, 2011 4:58:34 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [4164]
    Sep 6, 2011 4:58:35 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SAHI/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=sahi_b2dd04160a00704d300b64704179a7754d57__SahiAmpersandSahi__startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized%3FstartUrl%3Dhttp%253A%252F%252Fsahi.example.com%252F_s_%252Fdyn%252FDriver_initialized"
    Sep 6, 2011 4:58:40 PM net.sf.sahi.test.ProcessHelper$PIDGatherer run
    INFO: PIDs: [3484]; 5203 ms
    Sep 6, 2011 4:58:40 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: [3484]


    *****************My classes are like this:**********************

    *****JavaClienttest.java*****

    package in.co.sahi;

    import junit.framework.TestCase;
    import net.sf.sahi.client.Browser;
    import net.sf.sahi.client.ExecutionException;
    import net.sf.sahi.config.Configuration;

    public class JavaClientTest extends TestCase {

    private Browser browser;
    private String userDataDirectory;

    public JavaClientTest(String name) {

    }
    protected void setUp() throws Exception {
    String sahiBase = "C:\\Program Files\\SAHI\\"; // where Sahi is installed or unzipped
    userDataDirectory = "C:\\Program Files\\SAHI\\userdata\\";
    Configuration.initJava(sahiBase, userDataDirectory); // Sets up configuration for proxy. Sets Controller to java mode.

    browser = new Browser("firefox");
    browser.open();

    }
    public void testGoogle() throws ExecutionException,InterruptedException{
    browser.navigateTo("http://www.google.com";);
    browser.waitFor(10000);
    browser.textbox("q").setValue("sahi forums");
    browser.waitFor(10000);
    browser.submit("Google Search").click();
    browser.waitFor(10000);
    //browser.waitFor(1000);
    browser.link("Forums - Sahi - Web Automation and Test Tool").click();
    browser.wait(10000);
    browser.link("Login").click();
    browser.wait(10000);
    System.out.println(":: browser.textbox(\"req_username\").exists() = " + browser.textbox("req_username").exists());
    }
    public void testSahiDemoSite()throws InterruptedException{
    browser.navigateTo("http://sahi.co.in/demo/training/";);
    browser.wait(10000);
    browser.textbox("user").setValue("test");
    browser.wait(10000);
    browser.password("password").setValue("secret");
    browser.wait(10000);
    browser.submit("Login").click();
    browser.wait(10000);
    browser.textbox("q").setValue("2");
    browser.wait(10000);
    browser.textbox("q[1]").setValue("9");
    browser.wait(10000);
    browser.textbox("q[2]").setValue("4");
    browser.wait(10000);
    browser.button("Add").click();
    browser.wait(10000);
    System.out.println(":: browser.textbox(\"total\").value()=" + browser.textbox("total").value());
    }
    protected void tearDown() throws Exception {
    browser.close();
    }

    }


    *****SingleSessionTestRunnerTest.java*****

    package in.co.sahi;

    import java.io.IOException;

    import net.sf.sahi.test.SingleSessionTestRunner;

    public class SingleSessionTestRunnerTest {

    public static void main(String[] args) throws IOException, InterruptedException{

    String browserType = "firefox";
    String base = "http://sahi.co.in/demo/training/";
    String logDir = "D:\\tm6\\";

    SingleSessionTestRunner testRunner = new SingleSessionTestRunner("my_session", browserType, base);
    testRunner.setInitJS("var $value1='test1';var $value2='test2'");
    net.sf.sahi.ant.Report report=new net.sf.sahi.ant.Report("tm6", logDir);
    testRunner.addReport(report);
    testRunner.start();
    String result = "";
    result = testRunner.executeSingleTest("D:/Work/Sahi/Sahi_OS/userdata/scripts/login_training.sah");
    System.out.println(result);
    // testRunner.setInitJS("var $value2='test2'");
    result = testRunner.executeSingleTest("D:/Work/Sahi/Sahi_OS/userdata/scripts/remaining_training.sah");
    System.out.println(result);
    testRunner.stop();
    }

    }
  • Hi Sumitra,

    I resolved it .
  • Hi bhaskar_palle,

    Can you please post what you did to resolve so that it will be help ful to others.

    Regards
    Sumitra
Sign In or Register to comment.