Monday, August 20, 2012

Adding new method to Selenium User Extensions

Below steps are required for adding the method to user extension js file. User can use the following method "getCurrentTime" as selenium function for returning the currentTime.


Add following code to user extensions js file

Method is getCurrentTime and it returns the currenTime\

// Return the currentTime in the format HH:MM:SS

Selenium.prototype.getCurrentTime = function(currentTime){

        var d = new Date();
        var curr_hour = d.getHours();
        var curr_min = d.getMinutes();
        var curr_sec = d.getSeconds();

        currentTime = curr_hour+':' + curr_min + ':'+ curr_sec;
        return currentTime;

};

No comments:

Post a Comment

Thanks for your valuable comments