3 posts, 0 answers
  1. SD
    SD avatar
    62 posts
    Member since:
    Apr 2010

    Posted 08 Jul 2010 Link to this post

    Hi there,

    Is there an equivalent to ContainsText() in order to verify whether a button exists or not ? 
    In the past I've been using an Xpath expression like //input[@value="Button caption name"]
    and based on the return value which was true/false I could determine the existence of the button on the page. 

  2. Missing user
    Missing user avatar

    Posted 12 Jul 2010 Link to this post

    Hi SD,

    I' not sure of a method that will return a boolean as you mentioned in the framework. Typically, when a page element is not found by a find method, null is returned by the method.

    You can try using the Wait.ForExists() as in:

    Find.ByExpression<HtmlButton>("Xpath=//input[@value=\"Button caption name\"]").Wait.ForExists();

    Nelson Sin
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. SD
    SD avatar
    62 posts
    Member since:
    Apr 2010

    Posted 14 Jul 2010 Link to this post

    Ta for that...
    For some reason it slips my mind find.xx returns NULL..;-)
    If anyone interested that's an option for a test function that validates if a button exists on  a page...

    public bool IsButtonExist(string buttonGUIName)
            StringBuilder buffer = new StringBuilder();
            if (Manager.ActiveBrowser.Find.ByXPath(buffer.ToString()) == null)
                return false;
                return true;
Back to Top