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.
Unable to run my test using Junit/Eclipse with Firefox configuration
Hello!
I'm using eclipse as an ide and i have junit installed as well. When i attempt to run my test as a junit test i get an error message from firefox that reads "Your Firefox profile cannot be loaded. It may be missing or inaccessible". I believe i have the correct directory listed but i have no idea whats wrong.
I'm able to access the firefox browser from the sahi controller and i used the same information within the config file from the controller.
If anyone can provide any input that would be great.
Thanks,
Lawrence
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;
/**
*
* This is a sample class to get started with Sahi Java.<br/>
* Have a look at DriverClientTest.java in sample_java_project dir for more detailed use of APIs.<br/>
* You need sahi/lib/sahi.jar in your classpath.</br>
*
*/
public class MyJavaClientTest extends TestCase {
private Browser browser;
private String sahiBase;
private String userDataDirectory;
/**
* This starts the Sahi proxy, toggles the proxy settings on Internet Explorer
* and starts a browser instance. This could be part of your setUp method in a JUnit test.
*
*/
public void setUp(){
sahiBase = "C:/Users/Lawrence/sahi"; // where Sahi is installed or unzipped
userDataDirectory = "C:/Users/Lawrence/sahi/userdata";
Configuration.initJava(sahiBase, userDataDirectory); // Sets up configuration for proxy. Sets Controller to java mode.
// toggleIEProxy(true); // Not needed for Firefox. Needed for IE, Safari, Chrome on Windows
String browserPath = "C:/Program Files (x86)/Mozilla Firefox/firefox.exe";
String browserProcessName = "firefox";
String browserOption = "-profile /mnt/sda4/Sahi/sahi0321/sahi/userdata/browser/ff/profiles/sahi1 -no-remote";
browser = new Browser(browserPath, browserProcessName, browserOption);
browser.open();
}
public void testGoogle() throws ExecutionException{
browser.navigateTo("http://www.google.com/"
;
browser.textbox("q").setValue("sahi forums");
browser.submit("Google 搜尋").click();
browser.waitFor(1000);
browser.link("Sahi - Web Automation and Test Tool").click();
browser.navigateTo("http://sahi.co.in/forums/"
;
browser.link("Login").click();
System.out.println("check: browser.textbox(\"req_username\").exists() = " + browser.textbox("req_username").exists());
}
public void tearDown(){
browser.close();
// proxy.stop();
// toggleIEProxy(false); // Not needed for Firefox. Needed for IE, Safari, Chrome on Wind$
}
}
I'm using eclipse as an ide and i have junit installed as well. When i attempt to run my test as a junit test i get an error message from firefox that reads "Your Firefox profile cannot be loaded. It may be missing or inaccessible". I believe i have the correct directory listed but i have no idea whats wrong.
I'm able to access the firefox browser from the sahi controller and i used the same information within the config file from the controller.
If anyone can provide any input that would be great.
Thanks,
Lawrence
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;
/**
*
* This is a sample class to get started with Sahi Java.<br/>
* Have a look at DriverClientTest.java in sample_java_project dir for more detailed use of APIs.<br/>
* You need sahi/lib/sahi.jar in your classpath.</br>
*
*/
public class MyJavaClientTest extends TestCase {
private Browser browser;
private String sahiBase;
private String userDataDirectory;
/**
* This starts the Sahi proxy, toggles the proxy settings on Internet Explorer
* and starts a browser instance. This could be part of your setUp method in a JUnit test.
*
*/
public void setUp(){
sahiBase = "C:/Users/Lawrence/sahi"; // where Sahi is installed or unzipped
userDataDirectory = "C:/Users/Lawrence/sahi/userdata";
Configuration.initJava(sahiBase, userDataDirectory); // Sets up configuration for proxy. Sets Controller to java mode.
// toggleIEProxy(true); // Not needed for Firefox. Needed for IE, Safari, Chrome on Windows
String browserPath = "C:/Program Files (x86)/Mozilla Firefox/firefox.exe";
String browserProcessName = "firefox";
String browserOption = "-profile /mnt/sda4/Sahi/sahi0321/sahi/userdata/browser/ff/profiles/sahi1 -no-remote";
browser = new Browser(browserPath, browserProcessName, browserOption);
browser.open();
}
public void testGoogle() throws ExecutionException{
browser.navigateTo("http://www.google.com/"
browser.textbox("q").setValue("sahi forums");
browser.submit("Google 搜尋").click();
browser.waitFor(1000);
browser.link("Sahi - Web Automation and Test Tool").click();
browser.navigateTo("http://sahi.co.in/forums/"
browser.link("Login").click();
System.out.println("check: browser.textbox(\"req_username\").exists() = " + browser.textbox("req_username").exists());
}
public void tearDown(){
browser.close();
// proxy.stop();
// toggleIEProxy(false); // Not needed for Firefox. Needed for IE, Safari, Chrome on Wind$
}
}
Answers