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.

Javascript Alert - Unable To Click Ok

stevePolackstevePolack Members
edited November -1 in Sahi - Open Source
Hi,
I have tried searching for an answer, but I am unable to find a solution to it that works.

When I navigate to a set url I am getting prompted with the following message:

Authentication Required
A user name and password are being requested by https://xx.xx.xx.xx. The site says: "Basic Auth"
UserName: ********
Password: ********
OK | Cancel

I have tried using _lastAlert and a few other ways, but can't seem to close this dialogue by clicking the OK button. _click(_button("OK")) also doesn't seem to work.

Bit stumped, any solutions would be appreciated?

Many thanks

Steve

Comments

  • Hi Steve,

    Which version of Sahi are you using?

    Thanks,
    Vivek
  • well.. we have these basic authentication too. Just let Sahi fill in your username and password and proceed.
    function authenticate() {
      if (_condition(_exists(_table("sahiAuth")))) {
        logAction("Demo authentifizierung mit 'xx' 'xx'");
        _setValue(_textbox("authUser"), "xx");
        _setValue(_password("authPassword"), "xx");
        _click(_submit("Authenticate"));
      }
    }
    

    If this doesn't work for you, there might be some other issue. Please provide sahi version, browser and OS and if you can, the URL.
  • Hi folks,

    Thank you for responding quickly.

    We are currently using v3.5, and the URL is an internal website unfortunately.

    However I will give the following a go, just tried a few ways on Friday on the Javascript alert, and didn't seem to work. But this may resolve the problem.

    Many thanks,

    Steve
Sign In or Register to comment.