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 handle Password Protected Page in Sahi?

arpitarpit Members
edited October 2011 in Sahi - Open Source
Hi Sumitra,

I have made some test cases for a password protect page :
mysitelink.com
But the problem is that I have to Fill Username and Password fields (which comes at start) again and again, Is there any other way to handle this?
Thanks.

Comments

  • Hi Arpit,

    It looks like this page needs a 401 authentication.

    Just navigate to the page through Sahi and you should see a webpage with username/password fields. Sahi converts 401 authentication dialogs into a simple html form. Just record them like a normal form field and it should work.

    Note: You will be asked for the username and password only the first time in a session.

    Regards,
    dkulkarni
  • arpitarpit Members
    edited October 2011
    Hi dkulkarni,
    Thanks for the reply. Actually I am not recording sahi scripts, I am doing it by using Behat Bundle and Mink Bundle. I have written a test like this :

    Feature: Registration form
    In order to register
    As a visitor
    I need to be able to submit a registration form


    @javascript @insulated
    Scenario: Show all errors if all fields are left empty
    Given I am on link "mysitelink.com"
    Then I press "wsl_register_button"
    Then I will see errors // Custom Function
    Then I wait for "3" second


    I have no idea how i can skip the 401 authentication. Every time when I run above test case it gives Sahi 5xx error.
    Is there any way that I can add the authorization information of a webpage to Sahi?

    I am using -

    OS : Ubuntu 10.10

    Browser: Chrome, Firefox

    Sahi : 3.5 version

    Thanks in advance.
  • Hi Arpit,

    You cannot "skip" a 401 authentication. I'm not too sure on why you would want to do that. You will have to provide the credentials and the login details need to be included in your script.

    Regards,
    dkulkarni
  • Hi dkulkarni,

    Thanks for reply. I wasn't meant that Sahi should skip 401 authentication, it just take credentials 1st time then next time it will not ask for authentication again. Now its working fine, I just did what you mentioned in previous reply, may be yesterday the website server was down for which I have made test cases. Thanks a lot.
This discussion has been closed.