I have the below function. If the button is in view it works fine. If its below the visible page it fails saying its trying to interact with an object out of the visible view. I have tried using 'scrollintoviewifneeded' but I get a message saying this is not supported by the object? I am really stuck and could do with any advice or help (New to automation).
function ClickByButtonText(/*buttonVisibleText*/)
{
var buttonVisibleText = "VALIDATE"
/* convert String to object */
var buttonText = ConvertToObject(buttonVisibleText);
//Waits upto 10 seconds for page to load
Sys.Browser("*").Page("*").Wait("10000");
waitUntilObjectIsVisible("//button[contains(text(),'" + buttonText + "')]");
var page = Sys.Browser("*").Page("*")
page.FindChild("contentText", buttonText, 500).Click();
}