Forum Discussion
Still trying. Its becoming very frustrating
Tried the below to find and click the button validate. Again if not visible on screen it does not work. If its visible it does work. If I add the scrollintoview again it says it is not supported. Surely such a simple thing cannot be this difficult? Imust be missing something simple?
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();
}
What is "ConvertToObject" doing? If you're using FindChild, the parameter buttonText needs to be a string, not an object.
Try just the following. Let's not get any fancier than we need to.
function ClickByButtonText() { var buttonVisibleText = "VALIDATE" Sys.Browser("*").Page("*").Wait("10000"); var page = Sys.Browser("*").Page("*") var mybutton = page.FindChild("contentText", buttonText, 500) if (myButton.Exists){ myButton.scrollIntoView(true); myButton.Click(); } }
Related Content
- 11 years ago
Recent Discussions
- 2 days ago
- 2 days ago