0
string drDataRow = string.Empty;

int intSerialNo = 1;
string strStep = "one";
string strColName = "Test";
string strExpectedRes = "It should work";
string strActRes = "Working";

HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();

To load the temp report htmlDoc.Load("E:/Test_Temp.htm");

var tblTestData = htmlDoc.DocumentNode.SelectSingleNode("//table[@id='tblTestData']/tbody");

drDataRow = "<tr><td>" + intSerialNo.ToString() + "</td><td>" + strStep + "</td><td>" + strColName + "</td><td>" + strExpectedRes + "</td><td>" + strActRes + "</td></tr>";

if (drDataRow != null && tblTestData != null)
{
    tblTestData.AppendChild(HtmlNode.CreateNode(drDataRow).ToString());
}

Here I couldn't see my updated report, its not getting loaded. I'm using this code in RPA Blue Prism tool with coding language as C#, uploaded dll also in correct path.

Getting an error as HtmlNode does not exists in the current context.

htmlDoc.Save("E:/Updated_Report.htm");

1 Answers1

0

You have to make sure to create a root document node. Then write nodes as children of the root node.

Here's an example. https://stackoverflow.com/a/8829955/12121394

Marat_Muginov
  • 62
  • 1
  • 8