Completed
Last Updated: 19 Dec 2013 16:17 by ADMIN
ADMIN
Velin Koychev
Created on: 13 Aug 2013 12:21
Type: Bug Report
2
XPath "./" expression does not work as expected.
If we have the following HTML:
<div name="1" id="grid" >
    <div name="2"  >
	     	  <div name="3">
		     </div>
		     <div name="4">
		     </div>
	    </div>
  </div>

and we try to use the following code:
 HtmlDiv element1 = Manager.ActiveBrowser.Find.ByXPath<HtmlDiv>("//div[@id='grid']");
 IList<HtmlDiv> list1 = element1.Find.AllByXPath<HtmlDiv>("./div");
 Log.WriteLine(list1.Count.ToString());

We expect to receive in the log file 2, because element1.Find.AllByXPath<HtmlDiv>("./div") should find divs with name  3 and 4.
However in the log file we have 1, because only div name="1" id="grid"  is found. 

Sample web page and test are attached in the internal description. 
1 comment
ADMIN
Iliyan Panchev
Posted on: 30 Sep 2013 11:19
Xpath is not IO path. so "./" is translated as "select current node", "now select from the root node"
http://www.w3schools.com/xpath/xpath_syntax.asp