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.

Please help - Sahi Java Code is not running

niteshsniteshs Members
edited November -1 in Sahi - Open Source
I was using SAHI Java to test a web application.
My java code was working fine till the day I did 2 things:

1. I deleted cookie (from firefox) related to my application. The moment I did this, Sahi-Java was not able to login into my application.

2. Since I was facing login problem, I downloaded and installed sahi_v35_20110213.jar under C:\Program Files

Now, the below code does not work after ((browser.cell("Sign In").click();))
Note - This code has been recorded using Sahi-Java Controller

String sahiBase = "C:\\Program Files\\Sahi"; // where Sahi is installed or unzipped
      String userDataDirectory = "C:\\Program Files\\Sahi\\userdata"; 
      Configuration.initJava(sahiBase, userDataDirectory);

      String browserPath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
      String browserProcessName = "firefox.exe";
      String browserOption = "-profile $userDir/browser/ff/profiles/sahi0 -no-remote";

      Browser browser = new Browser(browserPath, browserProcessName, browserOption);    
      browser.open();

      browser.navigateTo("http://172.16.25.52/callcenter");
      
      browser.textbox("userid").setValue("hh8001");
      browser.password("password").setValue("111111");
      browser.cell("Sign In").click();

      browser.textbox("stringValue").setValue("123455676");
      browser.link("Settings").click();
      browser.cell("Change Password").click();


For this code below exception is thrown:
Exception in thread "main" error:_setValue(_textbox("stringValue"), "123455676")
Error: The first parameter passed to _setValue was not found on the browser
    at net.sf.sahi.client.Browser.executeStep(Browser.java:205)
    at net.sf.sahi.client.Browser.execute(Browser.java:172)
    at net.sf.sahi.client.Browser.setValue(Browser.java:285)
    at net.sf.sahi.client.ElementStub.setValue(ElementStub.java:164)
    at SahiDriverDemo.main(SahiDriverDemo.java:43)


My DOUBT:

1. The above code works fine till this line:
browser.cell("Sign In").click();

And Sahi-Java does not execute any line after this code.

Why my successful script has started to fail? How should I approach to debug it.?

2. Is there any bug in sahi_v35_20110213.jar which is responsible for it?



Kindly help
-Nitesh

Comments

  • narayannarayan Administrators
    Hi Nitesh,

    Could you please install Sahi in a folder without spaces (Eg. C:\\Sahi) and check?

    Regards,
    Narayan
  • Hi Narayan,

    I installed it in C:\sahi but it did not help.

    Why is my script not able to execute after a given point? How should I debug it?

    I've no idea on how to debug it, it'll be great if you can help.
  • Hi Narayan,

    Here is the latest update for my problem:

    When I use below code (see bold), then sahi-java code executes fine.
    
    browserPath=C:\\Program Files\\Mozilla Firefox\\firefox.exe
    browserProcessName=firefox.exe
    [b]browserOption=-noframemerging -extoff[/b]
    
    


    BUT, when I change (with firefox) it to below option, it stops working.

    browserOption=-profile C:\\sahi\\userdata\\browser\\ff\\profiles\\sahi0 -no-remote


    So, My Doubts are:

    1. Where can I find a document that explains browser option field?

    2. When I use browserOption=-noframemerging -extoff then when my java code fails, then the browser window does not close inspite of executing browser.close() code. Let me know how can I do that with this option?

    3. How can I make my sahi-java code working when using browserOption=-profile C:\\sahi\\userdata\\browser\\ff\\profiles\\sahi0 -no-remote option?

    Kindly provide inline answers.
Sign In or Register to comment.