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.

how to ignore a request which cost long time

herseeingherseeing Members
edited November -1 in Sahi - Open Source
when I navigate to a website, there is a request which keeps the page loading for very long time,
and this request is not useful and we can ignore it to speed up our testing, but how to ignore it?
I really appreciate your help.


thanks,
Eric

Comments

  • Hi herseeing,

    Kindly have a look at: http://sahi.co.in/w/trouble-shooting-sahi.

    Also, could you try using _wait() API.

    Regards
    Sumitra
  • thanks Sumitra, the link you provided does not work and I do not want to use _wait()
    I found there is an API _addMock() which may be useful for me.
    my code is as below:
    _addMock(".*facebook[.]com.*");
    _navigateTo("http://www.mailinator.com";);

    but seems it does not work and the request that related facebook that i want to mock still take a lot of time to load.
  • Hi herseeing,

    Are you facing this issue on all the browsers?

    Also,check if you are getting any error on Sahi console? If so then please post it here.

    Have a look at : http://sahi.co.in/w/trouble-shooting-sahi

    check "My AJAX pages do not render correctly when navigating through Sahi, or I get Javascript errors only when going through Sahi" section and "Playback starts but keeps waiting on some page" section in the above URL.

    Also try the following:

    _addMock(".*facebook[.]com.*");
    _navigateTo("http://www.mailinator.com", true);

    For more Details: http://sahi.co.in/w/url-mocks

    What version of Sahi are you using?

    Regards
    Sumitra
  • Sumitra, my Sahi is v3.5.
    both of your suggestions don't work for me, what i am facing is just the time for loading facebook requests is a little bit long, and everything goes well.

    so i just want to mock the facebook related request. but seems _addMock() does not work. i want to check out why?

    thank you,
    Eric
  • narayannarayan Administrators
    Hi Eric,

    There seems to some problem when _addMock is specified on another domain. We are checking this. Meanwhile use this to mock out facebook
    // Go to Sahi's blank page on facebook domain
    _navigateTo("http://www.facebook.com/_s_/sprm/blank.htm", true);
    _addMock(".*facebook.*");
    _navigateTo("http://www.mailinator.com");
    // Now facebook pages should just show up with the URL.
    

    Let us know if that works.

    Regards,
    Narayan
  • Hi Narayan,

    thanks for your response.
    in your code, _addMock(".*facebook.*") seems not make any sense, facebook pages do not show up with the URL, but _navigateTo("http://www.facebook.com/_s_/sprm/blank.htm", true) seems make the page not need to loaded fully any more, it speed up the testing.

    actually i do not understand why the statement _navigateTo("http://www.facebook.com/_s_/sprm/blank.htm", true) can make the page no need to fully loaded before proceeding.


    thanks,
    Eric
Sign In or Register to comment.