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

How can I find an inner Element

1 Answer 23 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Michael asked on 19 Apr 2013, 04:42 PM
In an C# Script the following works:
            Element mainContent;
            mainContent = ActiveBrowser.WaitForElement(Pages.Deuba_Relaunch_FR_Navigation.Expressions.Productoverview_Maincontent_Div, 3000, false);        

How can i find an Element in mainContent, for Example an Div ?

It should give me back an HtmlDiv-element like

 HtmlDiv itemCount = Find.ByExpression<HtmlDiv>(new HtmlFindExpression("class=itemCount"));

Thanks for your help

1 Answer, 1 is accepted

Sort by
Boyan Boev
Telerik team
answered on 22 Apr 2013, 01:58 PM
Hi Michael,

I wrote a simple example against a demo application.

Here is the HTML:

<!DOCTYPE html>
    <table id="myTable">
                <div class="itemCount">Here is my div</div>
Here I am locating the table and then I am looking for the div inside of the table:

HtmlTable tab = ActiveBrowser.Find.ById<HtmlTable>("myTable");
HtmlDiv itemCount = tab.Find.ByAttributes<HtmlDiv>("class=itemCount");

Here is a video demonstration.

Hope this helps.

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