0

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();
}
Endorium
  • 15
  • 9

1 Answers1

0

Just so I am clear on what you want.

You have a button that makes your page scroll until something is in view ?

I've never used 'automation' something I'm assuming is a framework for automatic e2e testing.

BUT

Why not use simple jquery for this ? How do I get an element to scroll into view, using jQuery?

If you are unable to use jquery for this, you will have to make a (framework compatible) function yourself, something along the lines of

while(bla){

   // get co-ords
   // get offset
   // if co-ords - offset is not the result you want, scroll ++
   // if co-ords - offset is the result, get out of loop
}
Rheijn
  • 319
  • 3
  • 11