Data drive a link

4 posts, 0 answers
  1. Surendranath Potu
    Surendranath Potu avatar
    4 posts
    Member since:
    Jul 2009

    Posted 04 Jan 2012 Link to this post

    Hi ,

    Could you please help me how I could data drive a link .

    When I tried in the procedure explained in the reference documents , In Properties I'm not fining any any properties link "Text" or any other property to bind to local or external data source .

    Your help is appreciated .

    Regards
    Surendranath
  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 04 Jan 2012 Link to this post

    Hello Surendranath,

    It sounds like you want to Data Drive the Find Expression, which currently can only be done in Coded Step. This feature will be incorporated into the UI for our next major release, however. See our Roadmap page for more details.

    Here's an example against Bing.com:

    HtmlAnchor a = ActiveBrowser.Find.ByContent<HtmlAnchor>(Data["Col1"].ToString());
    Assert.IsNotNull(a);
    a.Click();

    My local data table has one column, named Col1, and contains five entries:
    1. Explore
    2. Images
    3. Videos
    4. Shopping
    5. News

    Ensure the DataEnabled box is checked for the test under Test Properties on the Project tab. If you're using the VS plugin, find Test Properties here.

    Kind regards,
    Anthony
    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. Surendranath Potu
    Surendranath Potu avatar
    4 posts
    Member since:
    Jul 2009

    Posted 11 Jan 2012 Link to this post

    Very sorry for late reply .

    Thanks Anthony for your prompt response .

    I got one more problem . I have a RadPanelBar containing a list box . I tried to pick the list item and clik the list item .

    I wanted to use Data driven testing for this and Tried the following code .

    //--------------------------------------------------------------

     

    Telerik.WebAii.Controls.Html.RadPanelBarItem ListItem1 = Find.ByExpression<Telerik.WebAii.Controls.Html.RadPanelBarItem>(

     

    "id=pbTemplates", "|",Data["Col1"].ToString());

     

     

     

     

    //MessageBox.Show(ListItem1.InnerText.ToString());

     

     

    ListItem1.Select();

    //-------------------------------------------------------------------------

    I'm passing two parameters in the above step . One is "ID" and the second one is "tagIndex" , as ID is id of radpanelbar it is constant and the "tagIndex" is the index of list item which I wanted to pass from data table .

    the problem I'm facing is , It is  clicking on last list item in the column .

    Could you please help me to get the solution for this.

    Thanks in advance .

    Best Regards ,
    Surendranath
  4. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 11 Jan 2012 Link to this post

    Hello Surendranath,

    In my testing of this Telerik HTML RadPanelBar site, I observed that the DOM is actually composed of Div, List, and ListItem elements. The following code worked for me:

    //Get the parent Div by Id
    HtmlDiv d = Find.ById<HtmlDiv>("RadPanelBar1");
     
    //Get the first child Div by index
    HtmlDiv d2 = d.Find.ByTagIndex<HtmlDiv>("div", 0);
     
    //Convert index number from data source to integer
    int idx = Convert.ToInt32(Data["Col1"].ToString());
     
    //Get a child ListItem by index and click it
    HtmlListItem li = d2.Find.ByTagIndex<HtmlListItem>("li", idx);
    li.MouseClick();

    Greetings,
    Anthony
    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