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.

Object oriented javascript usage in sahi

ratan.angadiratan.angadi Members
edited April 2012 in Sahi - Open Source
Hi,

I am writing some automation scripts in sahi and I want to know if I could youse object oriented javascript concepts in my automation script. Below script is what not working for me.

var x= new msg();
x.ShowMessage();



function msg()
{

function ShowMessage()
{
_alert('Method called');

}
}


when I execute the above script it shows successful but nothing happens. It works fine if I don't use OOPS concept. I mean i'm able to create object for Navigation() but nothing happens when i call the method inside Navigation.

Environment :

OS Name - Windows 7,
Brower Name and version - Internet explorer 9,
sahi Build: 2011-07-19

Comments

  • Hi

    Sahi differentiates heavily between browser and proxy code. _alert() will run in the context of the browser, while your functions are defined in the context of the proxy... as far as I understand it...
    resulting in code like this: http://sahi.co.in/forums/viewtopic.php?id=3548

    better try not to wrap Sahi Apis in OO Javascript :)
  • Hi there,
    Are you guys actually using OO javascript now or its concluded as not an option ?

    thanks
Sign In or Register to comment.