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.
Cannot get browser to launch when using Sahi with Cucumber
I cannot get the browser to launch when I kick off my cucumber-sahi tests. This was working until I installed the latest version of Sahi Pro. Now when I use Sahi and the controller everything works as expected through the Sahi Proxy, but when I run my cucumber tests I get the following error from my cucumber test:
C:\Users\afreeman\Documents\GitLab\cucumber_sahi\test>cucumber features\login.feature
error:Playback session not started. Verify that proxy is set on the browser. (RuntimeError)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sahi-1.2.1/lib/sahi.rb:145:in `execute_step'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sahi-1.2.1/lib/sahi.rb:123:in `navigate_to'
C:/Users/afreeman/Documents/GitLab/cucumber_sahi/test/features/support/env.rb:23:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/rb_support/rb_language.rb:122:in `load'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/rb_support/rb_language.rb:122:in `load_code_file'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime/support_code.rb:180:in `load_file'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime/support_code.rb:82:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime.rb:183:in `load_step_definitions'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime.rb:42:in `run!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/cli/main.rb:47:in `execute!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/bin/cucumber:13:in `<top (required)>'
C:/Ruby193/bin/cucumber:23:in `load'
C:/Ruby193/bin/cucumber:23:in `<main>'
I also see this error in the Sahi command prompt:
Sep 05, 2013 12:33:13 PM net.sf.sahi.ssl.SSLHelper getKeyManagerFactoryForRemoteFetch
INFO: No SSL Client Cert specified
Sep 05, 2013 12:34:09 PM net.sf.sahi.command.CommandExecuter execute
WARNING: commandClass = >net.sf.sahi.command.Driver< commandMethod = >setStep<
Sep 05, 2013 12:34:09 PM net.sf.sahi.command.CommandExecuter execute
WARNING: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sf.sahi.command.CommandExecuter.execute(CommandExecuter.java:55)
at net.sf.sahi.LocalRequestProcessor.handleDyn(LocalRequestProcessor.java:67)
at net.sf.sahi.LocalRequestProcessor.getLocalResponse(LocalRequestProcessor.java:40)
at net.sf.sahi.ProxyProcessor.processLocally(ProxyProcessor.java:209)
at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:86)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at net.sf.sahi.command.Driver.setStep(Driver.java:235)
at net.sf.sahi.command.Driver.setStep(Driver.java:145)
... 12 more
Keytool command not found at: keytool
Keytool command found at: C:\Program Files\Java\jre7\bin\keytool
Help!!
C:\Users\afreeman\Documents\GitLab\cucumber_sahi\test>cucumber features\login.feature
error:Playback session not started. Verify that proxy is set on the browser. (RuntimeError)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sahi-1.2.1/lib/sahi.rb:145:in `execute_step'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sahi-1.2.1/lib/sahi.rb:123:in `navigate_to'
C:/Users/afreeman/Documents/GitLab/cucumber_sahi/test/features/support/env.rb:23:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/rb_support/rb_language.rb:122:in `load'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/rb_support/rb_language.rb:122:in `load_code_file'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime/support_code.rb:180:in `load_file'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime/support_code.rb:82:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime.rb:183:in `load_step_definitions'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/runtime.rb:42:in `run!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/lib/cucumber/cli/main.rb:47:in `execute!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.6/bin/cucumber:13:in `<top (required)>'
C:/Ruby193/bin/cucumber:23:in `load'
C:/Ruby193/bin/cucumber:23:in `<main>'
I also see this error in the Sahi command prompt:
Sep 05, 2013 12:33:13 PM net.sf.sahi.ssl.SSLHelper getKeyManagerFactoryForRemoteFetch
INFO: No SSL Client Cert specified
Sep 05, 2013 12:34:09 PM net.sf.sahi.command.CommandExecuter execute
WARNING: commandClass = >net.sf.sahi.command.Driver< commandMethod = >setStep<
Sep 05, 2013 12:34:09 PM net.sf.sahi.command.CommandExecuter execute
WARNING: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sf.sahi.command.CommandExecuter.execute(CommandExecuter.java:55)
at net.sf.sahi.LocalRequestProcessor.handleDyn(LocalRequestProcessor.java:67)
at net.sf.sahi.LocalRequestProcessor.getLocalResponse(LocalRequestProcessor.java:40)
at net.sf.sahi.ProxyProcessor.processLocally(ProxyProcessor.java:209)
at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:86)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at net.sf.sahi.command.Driver.setStep(Driver.java:235)
at net.sf.sahi.command.Driver.setStep(Driver.java:145)
... 12 more
Keytool command not found at: keytool
Keytool command found at: C:\Program Files\Java\jre7\bin\keytool
Help!!
Answers
It is possible that you are initializing Browser with old parameters.
Please initialize it this way.
def init_browser()
browser_type = "firefox"
return Sahi::Browser.new(browser_type)
end
The correct way to initialize now is to pass one parameter, browser_type. This corresponds to the <name> tag for the specific browserType in userdata/config/browser_types.xml.
After this change, the browser should get launched correctly and the test should run.
and I made two classes-
________________________________________________________________________
package testcases;
import org.junit.After;
import org.junit.Before;
import net.sf.sahi.client.Browser;
import net.sf.sahi.config.Configuration;
public class BaseTestClass {
protected Browser browser;
String browserPath = "C://Program Files (x86)/Google/Chrome/Application";
String browserProcessName = "chrome";
String browserOption ="C://Sahi_pro/userdata/browser/chrome/profiles/sahi1";
@Before
public void createConn() throws Exception {
Configuration.initJava("C://Sahi_pro/config/sahi.properties", "C://Sahi_pro/userdata/config/userdata.properties");
browser = new Browser(browserPath, browserProcessName, browserOption);
browser.open();
}
@After
public void delConn() throws Exception {
browser.setSpeed(100);
browser.close();
}
public void login(){
browser.navigateTo("http://10.91.32.84:61400/workspace/login.qsp?userName=Admin&Password=Admin&redirectUrl=http://10.91.32.84:61400/workspace/createNewXMLDocument.qsp?contentType=Business Document");
}
}
package testcases;
import net.sf.sahi.client.ElementStub;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class test4demo extends BaseTestClass {
@Before
public void setUp() {
login();
}
@After
public void tearDown() {}
@Test
public void testDemo1() {
browser.popup("Quark Publishing Platform Web Client").div("Document Content").click();
ElementStub es1=browser.div("Document Content");
browser.selectRange(es1,2,12);
browser.popup("Quark Publishing Platform Web Client").span("cke_button_icon cke_button_bold_icon").click();
}
}
___________________________________________________________
now I go to Run-> External Tools->external tools configuration
Name:StartSahi
Main---
Location:c:\Sahi_pro\bin\sahi.bat
Working Directory:C:\Sahi_pro\bin
error log-
eclipse.buildId=I20100608-0911
java.version=1.7.0
Launch configuration Start Sahi at file:/C:/Users/jjoy/workspace/.metadata/.plugins/org.eclipse.debug.core/.launches/Start%20Sahi.launch does not exist.
Failure Trace-
error:Playback session not started. Verify that proxy is set on the browser.
at net.sf.sahi.client.Browser.executeStep(Browser.java:296)
at net.sf.sahi.client.Browser.executeStep(Browser.java:266)
at net.sf.sahi.client.Browser.execute(Browser.java:227)
at net.sf.sahi.client.Browser.navigateTo(Browser.java:181)
at net.sf.sahi.client.Browser.navigateTo(Browser.java:170)
at testcases.BaseTestClass.login(BaseTestClass.java:36)
at testcases.test4demo.setUp(test4demo.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
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)
Please guide.