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.

Simulating clicking the browser stop button.

pankaj.nithpankaj.nith Members
edited November -1 in Sahi - Open Source
Hi,

Anybody having any idea about how we can simulate clicking the stop button of the browser?
Stringy can you suggest something like using the history object for simulating clicking the back button.

Regards,
Pankaj.

Comments

  • It looks like the window object is what you are looking for:

    window.stop()

    http://www.javascriptkit.com/jsref/window.shtml
  • Great!
    Had thought of something like that but never tried it (am such a lazy guy) as couldn't find any document on this.
    Will check this out first thing in the morning...
    Thanks again.. :)

    Regards,
    Pankaj
  • Hi Stringy,

    I tried your suggestion and the thing works and was what I was looking for. But it couldn't help solving my proble. What I need is to wait for a page to load for a certain period and after that forcefully stop the page loading. But the next step in sahi is executed only after the page is loaded completely. So in my case I am having the problem because the page never loads completely and sahi keeps on waiting for it to load completely to execute the next step. As the page never loads completely the next step (window.stop() in this case) never gets executed and sahi keeps on waiting.

    Anyone any suggestions please.

    Thanks and Regards,
    Pankaj.
  • Ok, you need the browser to stop and then reload to get the rest of the script to run... Hmmm...

    How about:

    <<< do stuff >>>

    window.stop()

    <<< timer loop or do stuff >>> // http://www.w3schools.com/jsref/jsref_obj_date.asp

    history.go(0); // reload the page
  • Thanks Stringy :)

    I tried to use window.stop() in conjunction with setTimeOut() but in vain.
    The line of code appearing after the link click that leads to the desired page ( the page never gets completely loaded), sahi keeps on waiting and the next line of code (window.stop() in this case)never gets a chance to be executed.. :(

    Regards,
    Pankaj.
  • narayannarayan Administrators
    It should be possible to force Sahi to continue. Let me dig into the code and let you know.
  • That would be really great!
    Please guide if we can do something at our ends to make it better...considering i am naive at development.
  • Hey Pankaj...

    I found this and was wondering if it was any help to you...

    http://www.w3schools.com/htmldom/met_win_settimeout.asp
  • Hi,

    You guys are wonderful... :)
    I used this after your suggestion to go through the w3school tutorials. but the problem remains same that sahi never gets to execute the next line of code as it keeps waiting for the page to load completely. I am not sure i am implementing it properly or not :(.
    I am sure 'we' will get to a solution :)

    Regards,
    Pankaj.
  • I need something similar. What I need, is to simulate clicking the browser back button. This is to test going back to previous page, so _navigateTo won't actually test this. Can anyone help?
Sign In or Register to comment.