AngleSharp.XPath icon indicating copy to clipboard operation
AngleSharp.XPath copied to clipboard

SelectSingleNode() doesn't select <tr>

Open ashahabov opened this issue 1 year ago • 0 comments

In the provided code snippet, the SelectSingleNode() method is expected to return an instance of INode for the selected <tr> element within the HTML content. However, the method is returning null, which indicates a potential bug in the library.

Repro

var context = BrowsingContext.New(Configuration.Default);
var parser = context.GetService<IHtmlParser>();
var document = await parser.ParseDocumentAsync("<table><tr></tr></table>");

var trNode = document.Body.SelectSingleNode("//table/tr");

Actual Result

trNode is null

Expected Result

trNode is not null

Environment

.csproj

<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
  <PackageReference Include="AngleSharp" Version="1.1.2" />
  <PackageReference Include="AngleSharp.XPath" Version="2.0.4" />
</ItemGroup>

ashahabov avatar Jun 07 '24 12:06 ashahabov