This is a migrated thread and some comments may be shown as answers.

Data drive a link

3 Answers 117 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Surendranath Potu
Top achievements
Rank 1
Surendranath Potu asked on 04 Jan 2012, 10:16 AM
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

3 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 04 Jan 2012, 05:28 PM
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
0
Surendranath Potu
Top achievements
Rank 1
answered on 11 Jan 2012, 11:42 AM

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
0
Anthony
Telerik team
answered on 11 Jan 2012, 07:46 PM
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
Tags
General Discussions
Asked by
Surendranath Potu
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Surendranath Potu
Top achievements
Rank 1
Share this question
or