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.

Using Sahi Javascript

stevePolackstevePolack Members
edited November -1 in Sahi - Open Source
Hi,
Is there a way of instantiating a browser element and setting it visible using Sahi ‘javascript’?
<browser>
Browser browser = new Browser();
browser.textbox("username").setValue("Admin");
</browser>
_assertEqual("Admin", _getValue(_textbox("username"))); //this will pass
_assertEqual("Admin2", _getValue(_textbox("username"))); //this should fail

I can get a text box to exist as the code above passes.

However I want is to be visible? Basically I am writing a function and want to make sure ‘my function’ does what it is intended?

Function myfunction(“textbox”)
{
Assert if visible
Assert if exists
}

Hopefully this makes sense? I don’t know if I can create a browser object and create a browser element that is associated with it, and set its visibility. But I can’t see many posts on the subject on the forum.

Comments

  • Hi, I posted this yesterday and was wondering if anyone had any idea?
    QA is very important on our team and we want to ensure that the functions we write have been tested before they are included in our test code.
    As stated above, we have a function called
    function checkButton($button_name)
    {
    _assertExists($button_name);
    _assert(_isVisible($button_name));
    }
    And I don’t know if anyone can advise how I can instantiate a button object, and set the parameters to being visible and pass this into the function, without actually creating a website, or do I have to create a website and point it to that? Any help or assistance would be greatly helpful? If this is not possible then I think the test web page is the only option I assume?
    Thanks
Sign In or Register to comment.