finding nested element

2 posts, 0 answers
  1. Chris
    Chris avatar
    34 posts
    Member since:
    Oct 2015

    Posted 24 Aug 2016 Link to this post

    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


  2. Pavel
    Pavel avatar
    904 posts

    Posted 29 Aug 2016 Link to this post

    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).
    Telerik by Progress
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top