Is there a way to accurately determine the number of rows in a table? I've attempted multiple methods (all unsuccessful) and this is my latest attempt:
var _tableOfInterestsCount = wait.Until(x => x.FindElements(By.XPath("//*[@id='gridBodyTable']/tbody")));
var _trs = wait.Until(x => x.FindElements(By.XPath(".//tr[@class = 'ms-crm-List-Row']")));
While debugging, I'm consistently getting Count = 1 even though there are actually 3 rows.
All three tr's have the same class.
Additionally, there's an attribute in the table itself that states: numrecords="3"
Yet, when I try to access this value, it also returns a count of 1 instead of 3.
var _tableOfInterestsCount = wait.Until(x => x.FindElement(By.XPath("//*[@id='gridBodyTable']")).GetAttribute("numrecords"));
Here is the relevant HTML code snippet:
<table class="ms-crm-List-Data" cellspacing="0" cellpadding="1" rules="rows" morerecords="0" totalrecordcount="3" allrecordscounted="1" oname="10046" numrecords="3" tabindex="0" primaryfieldname="new_name" summary="foo" border="1" id="gridBodyTable" style="border-style:None;border-collapse:collapse;">
<colgroup><col width="18px" class="ms-crm-List-CheckBoxColumn"><col width="302" name="new_name" class="ms-crm-List-DataColumn ms-crm-List-SortedColumn"><col width="127" name="createdon" class="ms-crm-List-DataColumn"><col></colgroup><thead><tr class="ms-crm-Hidden-List"><th scope="col" class="ms-crm-Hidden-List"></th><th scope="col" class="ms-crm-Hidden-List">שם</th><th ...etc
EDIT: Interestingly enough, with only 2 rows, the count shows as 0. I even attempted the following approach, still resulting in the incorrect attribute value:
Dictionary<string, object> attributes = executor.ExecuteScript("var items = {}; for (index = 0; index < arguments[0].attributes.length; ++index) { items...