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

How to handle Div type List Control?

1 Answer 25 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dipali
Top achievements
Rank 1
Dipali asked on 27 May 2012, 01:54 PM

Hi Telerik Team,

I am facing an issue while selecting an item from the list. I am trying to select an item from the list. The list is a ‘Div’ element. In DOM Explorer when I see the list and the items from the list. The list is shown as ‘Div’ tag and all the list items are also shown as ‘Div’ tag. So I believe that the control will not support the methods available for list.

To select an item from the list I am using below code. The code is not returning any error. But it also not selecting an item from the list.

ActiveBrowser.Window.SetFocus();

Pages.Page1.Frame.dropdownButton.Click(false);

System.Threading.Thread.Sleep(2000);

var testList = Pages.Page1.Frame.testList; 

HtmlDiv itemToSelect = testList.Find.ByExpression<HtmlDiv>("TagName=div", "class=dropDownItem","InnerText=" + listItemName); // listItemName is global variable

Assert.IsNotNull(itemToSelect, String.Format("Failed to find the list item '{0}' in the list.", listItemName));

// itemToSelect.Click(false);

// itemToSelect.MouseHover();

itemToSelect.ScrollToVisible();

itemToSelect.MouseClick();

System.Threading.Thread.Sleep(5000);

1 Answer, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 29 May 2012, 04:56 PM
Hello Dipali,

Can you please share the HTML for the elements you're acting upon? Or perhaps there's a public page you can provide that uses similar elements? It's difficult for me to identify why your code isn't working without seeing the page's DOM directly.

Also, why have you resorted to code to accomplish this task? You should be able to record standard steps through the browser, then Data Drive the item to select.

Regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Dipali
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Share this question
or