Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

browser.open invokes http://sahi.example.com site

cmblcmbl Members
edited 1:40AM in Sahi - Open Source
Hi Team,

When i open the browser as given in the below code, it tries to open the below given link in an explorer. Why does this happen? Can i change the URL to open?

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

http: // sahi . example . com/_s_/dyn/Driver_start?startUrl=http%3A%2F%2Fsahi.example.com%2F_s_%2Fdyn%2FDriver_initialized__SahiAmpersandSahi__sahisid=sahi_2cd7070b0586a04721087790fec7ddce4994

Regards,
Chandra

Comments

  • narayannarayan Administrators
    Chandra,

    That is the default URL that Sahi initializes itself with.

    If you are stuck at that page and the next steps are not executed, your proxy settings are not properly set on your browser.

    Use
    browser.navigateTo("your_url")
    to navigate to your page.

    Regards,
    Narayan
  • Hello Narayan,

    I am new to Sahi. I have the same problem as Chandra. I am not able to work on any other page except Sahi homepage. The record and playback is happening only on that page.

    I read your solution but it is still not clear to me, so could you please be more clear. And where should I use "browser.navigateTo("your_url")".

    Regards,
    Ananya
  • Please let me know about the solution as soon as possible. Thank you.

    Regards,
    Ananya
  • narayannarayan Administrators
    Hi Ananya,

    Are you running Sahi using Java driver?

    Regards,
    Narayan
  • Yes. I am using java- jre6.
  • Hello ananya

    is this example enough to point out where to place the browser.navigate?
    http://sahi.co.in/w/java
  • narayannarayan Administrators
    Hi Ananya,

    Please create a new post, explain exactly the steps you do to come to the point of error. (From the point of starting Sahi).

    I would also suggest you watch the video on http://sahi.co.in/w/using-sahi

    Regards,
    Narayan
  • Narayan,

    I referred the same video for installation and using. Once I select Google Chrome on the dashboard, if I enter url suppose Google. Now if I start recording from this page, the playback does not work. It says "--Stopped Playback: FAILURE--"

    Regards,
    Ananya
  • Any explanation of the failure in the log files?
  • Hi guys,

    Sahi controller is working fine. It was small mistake. I had not given enough delay between web pages while recording due to which recording was not done correctly. Thanx anyways.

    Regards,
    Ananya
  • Hi Narayan,

    I have doubt in Python. Please see if u can help.

    from datetime import datetime
    print("Hello world")
    sample = "D:\\python\\temp\\" + datetime.now().strftime("%Y_%B_%d__%H_%M_%S") + ".txt";
    logfile = open("sample.txt", "w")
    logfile.write("sample")
    logfile.close()

    In the above program the output is only 'Hello world'. A file containing date is not created. I am not able to find the error. I am not sure if line 3 is correct.

    Where should "D:\\python\\temp\\" + datetime.now().strftime("%Y_%B_%d__%H_%M_%S") + ".txt"; be stored?
  • Hi ananya

    could you plese create a new topic for your problem.

    Regards
    Wormi
  • Hey I am new to sahi java driver- for running java in eclipse I added two jar files ant and sahi
    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.


  • Why does the "Logs" link in Sahi Controller window point to "sahi.examples.com" instead of "localhost:9999", as it is done in Sahi Dashboard? Is this link configurable?
Sign In or Register to comment.