Jquery style css selectors

2 posts, 0 answers
  1. Joe
    Joe avatar
    1 posts
    Member since:
    Dec 2011

    Posted 02 Jan 2012 Link to this post


    I am currently working on a Poc for the testing suite and testing framework.  I had a question about how to query the elements.

    I want to query elements using a jquery style selector eg find me elements which have a class of x and are within elements of type p I tried to do this using the following :

    HtmlControl cc = this.TestFramework.Find.AllControls<HtmlControl>().Where(c => c.CssClass == ".x, p").FirstOrDefault();
    This returned nothing which is what I expected.

    To find these kinds of elements at the moment I have to do something like the following:

    Element element = this.TestFramework.Find.AllControls<HtmlDiv>().Where(c => c.CssClass == "formColWidth01").First().ChildNodes[0].ChildNodes[0];

    Do you have any plans to support jquery style selection for elements any time in the future?


  2. Cody
    Cody avatar
    3354 posts

    Posted 04 Jan 2012 Link to this post

    Hi Joe,

    At this time we do not have plans to implement jQuery style selection. Instead we have our own Find Expressions that are equivalent, if not better than jQuery style selection. Using our find expression the equivalent code looks like this:

    // Find all anchor tags having class=x
    ReadOnlyCollection<Element> ElementList1 = ActiveBrowser.Find.AllByExpression("class=x", "tagname=a");
    // OR
    // Find all anchor tags having class=x
    ReadOnlyCollection<HtmlAnchor> ElementList2 = ActiveBrowser.Find.AllByExpression<HtmlAnchor>("class=x");

    All the best,
    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
Back to Top