Hi
I think I have found a bug in the HtmlFindExpressions either that or I have stared my self completely blind on a obvious problem and in any case i need somebody to review and help :)
Problem:
I have a HtmlFindExpression that I belive should do the same as a XPATH I have created, the problem is that my XPATH works but my HtmlFindExpression only find 1 item(Expected 10). I have created some test code below and put some areas around the blocks.
Explation of areas:
Area1:
Finding elements with xpath which works as expected
Problem: none
Area2:
Finding elements with pure HtmlFindExpression.
Problem: Finds 1 element instead of 10
Area3:
Attempting to find the element by putting xpath inside a HtmlFindExpression.
Problem: Telerik throws error that it doesn't support hierarchal dependency in HtmlFindExpressions, but there isn't a hierarchal dependency in this xpath.
NOTE: Added a screenshot of the result i get.
I think I have found a bug in the HtmlFindExpressions either that or I have stared my self completely blind on a obvious problem and in any case i need somebody to review and help :)
Problem:
I have a HtmlFindExpression that I belive should do the same as a XPATH I have created, the problem is that my XPATH works but my HtmlFindExpression only find 1 item(Expected 10). I have created some test code below and put some areas around the blocks.
Explation of areas:
Area1:
Finding elements with xpath which works as expected
Problem: none
Area2:
Finding elements with pure HtmlFindExpression.
Problem: Finds 1 element instead of 10
Area3:
Attempting to find the element by putting xpath inside a HtmlFindExpression.
Problem: Telerik throws error that it doesn't support hierarchal dependency in HtmlFindExpressions, but there isn't a hierarchal dependency in this xpath.
NOTE: Added a screenshot of the result i get.
Manager.LaunchNewBrowser(BrowserType.FireFox);
ActiveBrowser.NavigateTo(
"http://www.tradingfloor.com/topics/london-interbank-offered-rate"
);
Thread.Sleep(10000);
// Didn't bother with a real wait.
ActiveBrowser.RefreshDomTree();
// Expected count is 10
// Area1
// Test with XPATH: This seems to work
Console.WriteLine(
"AREA1 ** START **"
);
string
xpath =
"//li[contains(@class,'postItem') and @data-url]"
;
ReadOnlyCollection<Element> collection = ActiveBrowser.Find.AllByXPath(xpath);
Console.WriteLine(
"XPATH find all as element count: "
+ collection.Count);
ReadOnlyCollection<HtmlListItem> collection1 = ActiveBrowser.Find.AllByXPath<HtmlListItem>(xpath);
Console.WriteLine(
"XPATH find all as HtmlListItem count: "
+ collection1.Count);
Console.WriteLine(
"AREA1 ** END **"
);
// Area2
// Test with HtmlFindExpression: This finds nothing
Console.WriteLine(
"AREA2 ** Start **"
);
HtmlFindExpression findExp =
new
HtmlFindExpression(
"tagname=li"
,
"class=~postItem"
,
"innermarkup=~data-url"
);
ReadOnlyCollection<Element> collection4 = ActiveBrowser.Find.AllByExpression(findExp);
Console.WriteLine(
"HtmlFindExpression find all as element count: "
+ collection4.Count);
ReadOnlyCollection<HtmlListItem> collection5 = ActiveBrowser.Find.AllByExpression<HtmlListItem>(findExp);
Console.WriteLine(
"HtmlFindExpression find all as HtmlListItem count: "
+ collection5.Count);
Console.WriteLine(
"AREA2 ** END **"
);
// Area3
// Test with XPATH inside HtmlFindExpression: This is misinterpreted
Console.WriteLine(
"AREA3 ** Start **"
);
HtmlFindExpression findExp1 =
new
HtmlFindExpression(
"xpath=//li[contains(@class,'postItem') and @data-url]"
);
ReadOnlyCollection<Element> collection2 = ActiveBrowser.Find.AllByExpression(findExp1);
ReadOnlyCollection<HtmlListItem> collection3 = ActiveBrowser.Find.AllByExpression<HtmlListItem>(findExp1);
Console.WriteLine(
"AREA3 ** END **"
);