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

finding nested element

1 Answer 105 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 24 Aug 2016, 06:32 PM

In my attached code sample, I have added an ID to a particular HtmlDiv called "THIS_TEXT". In a coded step, how would you go about finding that particular div if the ID was not added? I have something like this currently:

 

HtmlDiv divContainer = Manager.ActiveBrowser.Find.ByAttributes<HtmlDiv>("class=x-grid3-row-first");

HtmlTable table = divContainer.Find.ByAttributes<HtmlTable>("class=x-grid3-row-table");

// Fails on step above: Object reference not set to an instance of an object. Am I missing something?

IList<HtmlTableRow> tableRowList = divContainer.Find.AllByTagName<HtmlTableRow>("tr");
string returnValue = String.Empty;
for (int i = 1; i < 2; i++)
{
   returnValue = tableRowList[i].Cells[1].InnerText.ToString();
}

 

Any advice/tips/feedback is appreciated for this newbie...

- Chris

 

1 Answer, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 29 Aug 2016, 10:46 AM
Hello Chris,

It would be easier for us to assist if you provide the html of the page you are automating (or at least the elements that are related to the question).
 
Regards,
Pavel
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Share this question
or