i am trying to traverse an html document:
<body class="style_0">
<div>
<div class="style_1">Pending Test List</div>
<table style=" width: 100%;" id="AUTOGENBOOKMARK_4365445353431356880">
<col>
<col>
<tbody>
<tr>
<td style="vertical-align: baseline;">
<div class="style_4">Pending Test List</div>
</td>
<td style="vertical-align: baseline;">
<div class="style_5">SOME AGENCY Laboratories, Inc.</div>
</td>
</tr>
</tbody>
</table>
<table class="style_6" style=" width: 4.531in;" id="AUTOGENBOOKMARK_5083738604442918131">
<col style=" width: 1in;">
<col class="style_7" style=" width: 0.75in;">
<col class="style_8" style=" width: 0.6in;">
<col style=" width: 0.75in;">
<col style=" width: 2.375in;">
<tbody>
<tr class="style_9" style=" height: 0.5in;">
<td style="vertical-align: middle;">
<div class="style_10">Report Range:</div>
</td>
<td style="vertical-align: middle;">
<div class="style_11">01/01/2012</div>
</td>
<td style="vertical-align: middle;">
<div class="style_12">through</div>
</td>
<td style="vertical-align: middle;">
<div class="style_13">01/31/2012</div>
</td>
<td style="vertical-align: middle;">
<div class="style_14">(by Date Entered)</div>
</td>
</tr>
</tbody>
</table>
<table class="style_15" style=" width: 100%;" id="AUTOGENBOOKMARK_7602283385844673591" iid="/526
(QuRs78576248:0)">
<col style=" width: 0.75in;">
<col style=" width: 1.25in;">
<col style=" width: 1in;">
<col style=" width: 1.5in;">
<col style=" width: 1.5in;">
<col style=" width: 1.5in;">
<col>
<thead>
<tr>
<td colspan="4" style="vertical-align: baseline;"></td>
<td style="vertical-align: baseline;"></td>
<td style="vertical-align: baseline;"></td>
<td style="vertical-align: baseline;"></td>
</tr>
<tr>
<td style="vertical-align: baseline;">
<div class="style_16">Entered</div>
</td>
<td style="vertical-align: baseline;">
<div class="style_16">Spec. ID</div>
</td>
<td style="vertical-align: baseline;">
<div class="style_16">Batch/Pos.</div>
</td>
<td style="vertical-align: baseline;">
<div class="style_16">Test</div>
</td>
<td style="vertical-align: baseline;">
<div class="style_16">Client ID</div>
</td>
<td style="vertical-align: baseline;">
<div class="style_16">Client Name</div>
</td>
<td style="vertical-align: baseline;">
<div class="style_16">Agency</div>
</td>
</tr>
</thead>
<tbody>
<tr>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_18">1/30/12</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_19">ZZ324sdf</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_18">51446 / 75</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">HOLD_DE</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">234234</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">smith, john</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">PPPM-6P - SOME AGENCY</div>
</td>
</tr>
<tr>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_18">1/31/12</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_19">SFD3434</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_18">51668 / 17</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">HOLD_DE</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">FOY, EL</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">FOY, ALEX</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">someagency & Associates LLC</div>
</td>
</tr>
<tr>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_18">1/31/12</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_19">SFD3434</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_18">51668 / 25</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">HOLD_DE</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">JAMISON, PA</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">JAMISON, ROY</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">someagency & Associates LLC</div>
</td>
</tr>
<tr>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_18">1/31/12</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_19">SFD3434</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_18">51669 / 34</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">HOLD_DE</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">NEWMAN, SO</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">NEWMAN, ALEX</div>
</td>
<td class="style_17" style="vertical-align: baseline;">
<div class="style_20">someagency & Associates LLC</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2" style="vertical-align: baseline;">
<div class="style_21">Total Tests:</div>
</td>
<td style="vertical-align: baseline;">
<div class="style_22">4</div>
</td>
<td style="vertical-align: baseline;"></td>
<td style="vertical-align: baseline;"></td>
<td style="vertical-align: baseline;"></td>
<td style="vertical-align: baseline;"></td>
</tr>
</tfoot>
</table>
<table style=" width: 100%;" id="AUTOGENBOOKMARK_8507236727661888074">
<col>
<col>
<col>
<tbody>
<tr>
<td style="vertical-align: baseline;">
<div class="style_2">
<br>Feb 13, 2012 9:37 AM</div>
</td>
<td style="vertical-align: baseline;">
<div class="style_3">
<br>
<div style="text-align:center;">Page 1</div>
</div>
</td>
<td style="vertical-align: baseline;"></td>
</tr>
</tbody>
</table>
</div>
</body>
for this data:
so far i have this:
foreach (var row in htmlSnippet.DocumentNode.SelectNodes("//table[#class = 'style_15']/tbody/tr"))
{
foreach (var cell in row.SelectNodes("div[#class='*']"))
{
textBox1.Text = cell.InnerHtml.ToString();
}
}
however i am not returning anything!
this line is working:
//table[#class = 'style_15']/tbody/tr
but this does not return anthing:
("div[#class='*']"))
please let me know what i am doing wrong! i need help returning every piece of data as shown in the image (except for the field names)
The * is typically used for matching any element or attribute name, not any value. If you want to match all div elements having a class attribute with any value, just use #class.
foreach (var row in htmlSnippet.DocumentNode.SelectNodes("//table[#class = 'style_15']/tbody/tr/td"))
{
foreach (var cell in row.SelectNodes("div[#class]"))
{
textBox1.Text = cell.InnerHtml.ToString();
}
}
You probably want simply div[#class]—a div element that has a class attribute.
Oh, it's also worth noting that the HTML/XML sample you provided is not well-formed. I had to remove all the col elements, and close the br elements. Maybe, for C#, that's an issue... I know it is for XSL in general... not sure about XPath.
I don't have time to code up a C# example, but here's a simple XSL:
<xsl:template match="/">
<so>
<xsl:apply-templates select="//table[#class = 'style_15']/tbody/tr"/>
</so>
</xsl:template>
<xsl:template match="div[#class]">
<xsl:copy-of select="."/>
</xsl:template>
I get this output:
<so>
<div class="style_18">1/30/12</div>
<div class="style_19">ZZ324sdf</div>
<div class="style_18">51446 / 75</div>
<div class="style_20">HOLD_DE</div>
<div class="style_20">234234</div>
<div class="style_20">smith, john</div>
<div class="style_20">PPPM-6P - SOME AGENCY</div>
<div class="style_18">1/31/12</div>
<div class="style_19">SFD3434</div>
<div class="style_18">51668 / 17</div>
<div class="style_20">HOLD_DE</div>
<div class="style_20">FOY, EL</div>
<div class="style_20">FOY, ALEX</div>
<div class="style_20">someagency & Associates LLC</div>
<div class="style_18">1/31/12</div>
<div class="style_19">SFD3434</div>
<div class="style_18">51668 / 25</div>
<div class="style_20">HOLD_DE</div>
<div class="style_20">JAMISON, PA</div>
<div class="style_20">JAMISON, ROY</div>
<div class="style_20">someagency & Associates LLC</div>
<div class="style_18">1/31/12</div>
<div class="style_19">SFD3434</div>
<div class="style_18">51669 / 34</div>
<div class="style_20">HOLD_DE</div>
<div class="style_20">NEWMAN, SO</div>
<div class="style_20">NEWMAN, ALEX</div>
<div class="style_20">someagency & Associates LLC</div>
</so>
This is just an intermediate output to show that the XPath is working correctly.
Hope this helps.
Related
So basically i have Web page form named Lab4.aspx but everytime i pressed button, it will always direct to script runat="server" and not the aspx.cs,also the button is changed back to Button_1 when i changed it to BtnSubmit
<script runat="server">
Protected Sub Button1_Click(sender As Object, e As EventArgs)
End Sub
</script>
For the aspx.cs, i already changed the public partial class to public partial class Lab4: System.Web.UI.Page in the aspx.cs and also name the file to Lab4.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Lab4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BtnSubmit_Click(object sender, EventArgs e)
It would be great if this mystery can be solved because i have tried search for this solution everywhere
Here's the code for the button control on aspx page
<asp:Button ID="BtnSubmit" runat="server" onclick="Button1_Click" Text="Submit"
Width="85px" />
and this is the full code for aspx page
<script runat="server">
Protected Sub Button1_Click(sender As Object, e As EventArgs)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
font-size: xx-large;
font-family: "Tw Cen MT";
height: 1161px;
}
.style2
{
text-decoration: underline;
}
.style3
{
font-size: x-large;
background-color: #9933FF;
}
.style4
{
width: 100%;
}
.style5
{
width: 243px;
}
.style6
{
width: 609px;
}
.style7
{
width: 243px;
height: 32px;
}
.style8
{
width: 609px;
height: 32px;
background-color: #FFFFFF;
}
.style9
{
height: 32px;
}
.style10
{
background-color: #9966FF;
}
.style11
{
width: 243px;
height: 31px;
}
.style12
{
width: 609px;
height: 31px;
}
.style13
{
height: 31px;
}
.style14
{
width: 303px;
font-size: x-large;
}
.style15
{
width: 303px;
height: 41px;
}
.style16
{
height: 41px;
}
.style17
{
font-size: x-large;
}
.style20
{
width: 254px;
}
.style21
{
width: 254px;
height: 41px;
}
.style22
{
width: 243px;
height: 45px;
}
.style23
{
width: 609px;
height: 45px;
}
.style24
{
height: 45px;
}
.style25
{
width: 303px;
font-size: x-large;
height: 32px;
}
.style26
{
width: 254px;
height: 32px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="style1">
Nasi Tapau O<span class="style2">nline Order
</span>
<br />
<br />
<span class="style3"><span class="style10">Customer's Details
</span>
<br />
<table class="style4">
<tr>
<td class="style5">
Name :
</td>
<td class="style6">
<span class="style3">
<asp:TextBox ID="TxtName" runat="server" Width="545px"></asp:TextBox>
</span>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="style7">
</td>
<td class="style8">
</td>
<td class="style9">
</td>
<td class="style9">
</td>
</tr>
<tr>
<td class="style5">
Contact Number :</td>
<td class="style6">
<span class="style3">
<asp:TextBox ID="TxtContactNo" runat="server" Width="165px"></asp:TextBox>
</span>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
</td>
<td class="style6">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
Email :</td>
<td class="style6">
<span class="style3">
<asp:TextBox ID="TxtEmail" runat="server" Width="165px"></asp:TextBox>
</span>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="style7">
</td>
<td class="style8">
</td>
<td class="style9">
</td>
<td class="style9">
</td>
</tr>
<tr>
<td class="style5">
Order Details :</td>
<td class="style6">
</td>
<td>
Quantity :
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
</td>
<td class="style6">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
Rice :</td>
<td class="style6">
<asp:RadioButton ID="RBYes" runat="server" Text="Yes" />
<span class="style3"><asp:RadioButton ID="RBNo" runat="server"
style="background-color: #FFFFFF" Text="No" />
</span>
</td>
<td>
<span class="style3">
<asp:TextBox ID="TxtQRice" runat="server" Width="165px"></asp:TextBox>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style22">
</td>
<td class="style23">
</td>
<td class="style24">
</td>
<td class="style24">
</td>
</tr>
<tr>
<td class="style5">
Side Dishes :</td>
<td class="style6">
<asp:CheckBox ID="CBChicken" runat="server" style="background-color: #FFFFFF" Text="Chicken Curry - RM4.50" />
</td>
<td>
<span class="style3">
<asp:TextBox ID="TxtQChicken" runat="server" Width="165px"></asp:TextBox>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style7">
</td>
<td class="style8">
<span class="style3">
<asp:CheckBox ID="CBMixed" runat="server" OnCheckedChanged="CBMixed_CheckedChanged" style="background-color: #FFFFFF" Text="Mixed Vegetables - RM2.50" />
</span>
</td>
<td class="style9">
<span class="style3">
<asp:TextBox ID="TxtQMixed" runat="server" Width="165px"></asp:TextBox>
</span>
</td>
<td class="style9">
</td>
</tr>
<tr>
<td class="style5">
</td>
<td class="style6">
<span class="style3">
<asp:CheckBox ID="CBGrilled" runat="server" style="background-color: #FFFFFF" Text="Grilled Fish - RM4.00" />
</span>
</td>
<td>
<span class="style3">
<asp:TextBox ID="TxtQGrilled" runat="server" Width="165px"></asp:TextBox>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style7">
</td>
<td class="style8">
<span class="style3">
<asp:CheckBox ID="CBCondiment" runat="server" style="background-color: #FFFFFF" Text="Condiment - RM1.50" />
</span>
</td>
<td class="style9">
<span class="style3">
<asp:TextBox ID="TxtQCondiment" runat="server" Width="165px"></asp:TextBox>
</span>
</td>
<td class="style9">
</td>
</tr>
<tr>
<td class="style5">
Beverages :</td>
<td class="style6">
<span class="style3">
<asp:CheckBox ID="CBMangoJ" runat="server" style="background-color: #FFFFFF" Text="Mango Juice - RM3.00" />
</span>
</td>
<td>
<span class="style3">
<asp:TextBox ID="TxtMangoJuice" runat="server" Width="165px"></asp:TextBox>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
</td>
<td class="style6">
<span class="style3">
<asp:CheckBox ID="CBCendol" runat="server" style="background-color: #FFFFFF" Text="Cendol - RM3.00" />
</span>
</td>
<td>
<span class="style3">
<asp:TextBox ID="TxtCendol" runat="server" Width="165px"></asp:TextBox>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
</td>
<td class="style6">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="style11">
Delivery:</td>
<td class="style12">
<asp:DropDownList ID="DdlDelivery" runat="server">
<asp:ListItem Value="0">Self-pickup</asp:ListItem>
<asp:ListItem Value="1.50">Request For Delivery</asp:ListItem>
</asp:DropDownList>
</td>
<td class="style13">
</td>
<td class="style13">
</td>
</tr>
<tr>
<td class="style11">
</td>
<td class="style12">
</td>
<td class="style13">
<asp:Button ID="BtnSubmit" runat="server" onclick="Button1_Click" Text="Submit"
Width="85px" />
</td>
<td class="style13">
</td>
</tr>
</table>
<br />
<br />
<asp:Label ID="Label1" runat="server" style="background-color: #9966FF"
Text="Thank you for choosing us! Here are you order details :"></asp:Label>
<br />
<br />
</span>
<table class="style4">
<tr>
<td class="style14">
<span class="style17">Name :
</td>
<td class="style20">
<asp:Label ID="lblName" runat="server" Font-Size="X-Large"></asp:Label>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
Telephone :</td>
<td class="style20">
<span class="style17">
<asp:Label ID="LblTel" runat="server"></asp:Label>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
Email :</td>
<td class="style20">
<span class="style17">
<asp:Label ID="lblEmail" runat="server"></asp:Label>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td style="font-size: x-large">
Quantity :</td>
</tr>
<tr>
<td class="style25">
Rice :</td>
<td class="style26">
<span class="style17">
<asp:Label ID="lblRice" runat="server"></asp:Label>
</span>
</td>
<td class="style9">
<span class="style17">
<asp:Label ID="lblQRice" runat="server"></asp:Label>
</span>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
Side Dishes :</td>
<td class="style20">
<span class="style17">
<asp:Label ID="Label6" runat="server" Visible="False"></asp:Label>
</span>
</td>
<td>
<span class="style17">
<asp:Label ID="Label16" runat="server" Visible="False"></asp:Label>
</span>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
<span class="style17">
<asp:Label ID="Label7" runat="server" Visible="False"></asp:Label>
</span>
</td>
<td>
<span class="style17">
<asp:Label ID="Label17" runat="server" Visible="False"></asp:Label>
</span>
</td>
</tr>
<tr>
<td class="style15">
</td>
<td class="style21">
<span class="style17">
<asp:Label ID="Label8" runat="server" Visible="False"></asp:Label>
</span>
</td>
<td class="style16">
<span class="style17">
<asp:Label ID="Label18" runat="server" Visible="False"></asp:Label>
</span>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
<span class="style17">
<asp:Label ID="Label9" runat="server" Visible="False"></asp:Label>
</span>
</td>
<td>
<span class="style17">
<asp:Label ID="Label19" runat="server" Visible="False"></asp:Label>
</span>
</td>
</tr>
<tr>
<td class="style14">
Beverages :</td>
<td class="style20">
<span class="style17">
<asp:Label ID="lblMangoJ" runat="server"></asp:Label>
</span>
</td>
<td>
<span class="style17">
<asp:Label ID="lblQMangoJ" runat="server"></asp:Label>
</span>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
<span class="style17">
<asp:Label ID="lblCendol" runat="server"></asp:Label>
</span>
</td>
<td>
<span class="style17">
<asp:Label ID="lblQCendol" runat="server"></asp:Label>
</span>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
Delivery Method :</td>
<td class="style20">
<span class="style17">
<asp:Label ID="lblDelivery" runat="server"></asp:Label>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
Total :</td>
<td class="style20">
<span class="style17">
<asp:Label ID="lblTotal" runat="server"></asp:Label>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
Grand Total(Inclusive GST) :</td>
<td class="style20">
<span class="style17">
<asp:Label ID="lblTotalWGST" runat="server"></asp:Label>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style20">
</td>
<td>
</td>
</tr>
</table>
<br />
<br />
</div>
</form>
</body>
</html>
Your aspx page should actually start with something like this.
<%# Page Title="" Language="C#" MasterPageFile="" AutoEventWireup="true" CodeBehind="Lab4.aspx.cs" Inherits="" %>
CodeBehind="Lab4.aspx.cs" is the place where you specify which is your code behind file in C#.
Every aspx will have a page directive which will tell compiler where to look for its code file
<%# Page CodeFile="Lab4.aspx.cs" %>
documentation
I am facing an error in generating a proper PDF Document. the code i have, can generate a pdf document, it can download the document, but the issue is i cannot view the view the document. This is the Page I am trying to export to pdf.
Here is my code so far:
ASPX:
<asp:Button ID="btnDownload" CssClass="btn" runat="server" Text="Download Invoice" OnClick="btnDownload_Click" />
<asp:Panel ID="pnl" runat="server">
<div id="page-wrap">
<textarea id="header" style="height: 30px">PAYMENT DETAILS</textarea>
<div id="identity">
<textarea style="background-color: #F7F7F7;" readonly="readonly" id="address">My Name
My Street Address
Phone: 111-111-111</textarea>
<div id="logo">
<div id="logoctr">
</div>
<div id="logohelp">
<input id="imageloc" readonly="readonly" type="text" size="50" value="" /><br />
(max width: 540px, max height: 100px)
</div>
<img id="image" src="images/logo.png" alt="logo" />
</div>
</div>
<div style="clear: both"></div>
<div id="customer">
<textarea id="tbCustomer" readonly="readonly" runat="server"></textarea>
<table id="meta">
<tr>
<td class="meta-head">Payment ID</td>
<td>
<textarea readonly="readonly" runat="server" id="tbPID"></textarea></td>
</tr>
<tr>
<td class="meta-head">Date</td>
<td>
<textarea id="date" readonly="readonly" runat="server"></textarea></td>
</tr>
<tr>
<td class="meta-head">Amount Due</td>
<td>
<div class="due">
$
<asp:Label ID="lblTotal" runat="server" Text="Total"></asp:Label>
</div>
</td>
</tr>
</table>
</div>
<table id="items">
<tr>
<th>Property Title</th>
<th>Description</th>
<th>Status</th>
<th>Invoiced By</th>
<th>Total Payment</th>
</tr>
<tr class="item-row">
<td class="item-name">
<div class="delete-wpr">
<textarea readonly="readonly" id="tbTitle" runat="server"></textarea>
</div>
</td>
<td class="description">
<div contenteditable="true" id="tbDetail" class="blank" runat="server">
</div>
</td>
<td>
<textarea id="tbStatus" runat="server" readonly="readonly">PAID</textarea></td>
<td>
<textarea class="qty" readonly="readonly" id="tbInvoicedBy" runat="server"></textarea></td>
<td><span class="price">$
<asp:Label ID="tbTotal1" runat="server" Text="Total"></asp:Label></span></td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Vaccant</td>
<td class="total-value">
<div id="subtotal">$<asp:Label ID="lblVaccant" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Maintainance</td>
<td class="total-value">
<div id="total">$<asp:Label ID="lblMaintainance" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Property Insurance</td>
<td class="total-value">
<div id="Insurance">$<asp:Label ID="lblInsurance" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Dewa Bill</td>
<td class="total-value">
<div id="dewa">$<asp:Label ID="lblDewa" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Furnishing Cost</td>
<td class="total-value">
<div id="FurnishingCost">$<asp:Label ID="lblFurnishing" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Cleaning Fees</td>
<td class="total-value">
<div id="CleaningFees">$<asp:Label ID="lblCleaning" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">House Keeping</td>
<td class="total-value">
<div id="HouseKeeping">$<asp:Label ID="lblHouseKeeping" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Next Rent Due</td>
<td class="total-value">
<div id="paid">$<asp:Label ID="lblNextRent" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Rental Comission</td>
<td class="total-value">
<div id="RentalComission">$<asp:Label ID="lblRentalComission" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Credit Card Fees</td>
<td class="total-value">
<div id="CreditCardFees">$<asp:Label ID="lblCreditCardFees" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Pest Control</td>
<td class="total-value">
<div id="PestControl">$<asp:Label ID="lblPestControl" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Chillar Utilities</td>
<td class="total-value">
<div id="ChillarUtilities">$<asp:Label ID="lblChillarUtilities" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Du, etisilate wifi</td>
<td class="total-value">
<div id="DuEtisilatewifi">$<asp:Label ID="lblDuEtisilateWifi" runat="server" Text=""></asp:Label></div>
</td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line balance">Total Payment</td>
<td class="total-value balance">
<div class="due">$<asp:Label ID="lblTotal2" runat="server" Text=""></asp:Label></div>
</td>
</tr>
</table>
<div id="terms">
<h5>Terms</h5>
<textarea readonly="readonly">These payment details are final and non negotiable.</textarea>
</div>
</div>
</asp:Panel>
ASPX.CS
public void ExportToPDF()
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
pnl.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
sw.Close();
htmlparser.Close();
Response.Write(pdfDoc);
Response.End();
}
also it says the HTMLWorker class is obsolete.
I have a specific record I am attempting to select out of the data grid. Can some help with the XPath to get to that record.
I have tried the following but it doesn't work:
var elementEdit = driver.FindElement(By.XPath(".//tbody[#ClassName='ng-scope']/tr[#ng-binding='" + Username + "']"));
Here is the HTML code:
<tbody>
<!-- ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">pppp</td>
<td class="ng-binding">ppp</td>
<td class="ng-binding">joetester24</td>
<td class="ng-binding">+16195555555</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">gg</td>
<td class="ng-binding">ggg</td>
<td class="ng-binding">joetester99 ggff66</td>
<td class="ng-binding">+18587660891</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Evelina</td>
<td class="ng-binding">Papantoniou</td>
<td class="ng-binding">joetester996</td>
<td class="ng-binding">+12015555555</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Parvati</td>
<td class="ng-binding">Shallow</td>
<td class="ng-binding">joetester990</td>
<td class="ng-binding">+12015555555</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Doutzen</td>
<td class="ng-binding">Kroes</td>
<td class="ng-binding">joetester998</td>
<td class="ng-binding">+12015555555</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Evelina</td>
<td class="ng-binding">Papantoniou</td>
<td class="ng-binding">joetester996</td>
<td class="ng-binding">+12015555555</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Tereza</td>
<td class="ng-binding">Benesova</td>
<td class="ng-binding">joetester995</td>
<td class="ng-binding">+17036928692</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Ashley</td>
<td class="ng-binding">Degenford</td>
<td class="ng-binding">joetester992</td>
<td class="ng-binding">+17036976251</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Joe</td>
<td class="ng-binding">Tester114</td>
<td class="ng-binding">joetester114</td>
<td class="ng-binding">+16195551212</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Jodi Ann</td>
<td class="ng-binding">Paterson</td>
<td class="ng-binding">joetester994</td>
<td class="ng-binding">+17036951997</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Leilani</td>
<td class="ng-binding">Dowding</td>
<td class="ng-binding">joetester993</td>
<td class="ng-binding">+17036149998</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Naureen</td>
<td class="ng-binding">Zaim</td>
<td class="ng-binding">joetester991</td>
<td class="ng-binding">+17036957508</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Joe</td>
<td class="ng-binding">Tester445</td>
<td class="ng-binding">joetester445</td>
<td class="ng-binding">+16195551212</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Joe</td>
<td class="ng-binding">Tester229</td>
<td class="ng-binding">joetester229</td>
<td class="ng-binding">+16195551212</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Juliet</td>
<td class="ng-binding">Cariaga</td>
<td class="ng-binding">joetester997</td>
<td class="ng-binding">+17032715280</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Joe</td>
<td class="ng-binding">Tester825</td>
<td class="ng-binding">joetester825</td>
<td class="ng-binding">+16195551212</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">shdh</td>
<td class="ng-binding">dff</td>
<td class="ng-binding">joetesteroqur</td>
<td class="ng-binding">+16195553164</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">hdjd</td>
<td class="ng-binding">xddd</td>
<td class="ng-binding">joetester0183</td>
<td class="ng-binding">+16195553164</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">djd</td>
<td class="ng-binding">dff</td>
<td class="ng-binding">joetesterm</td>
<td class="ng-binding">+16195553164</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">gf</td>
<td class="ng-binding">ff</td>
<td class="ng-binding">joetesterqww</td>
<td class="ng-binding">+16195553164</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">hhh</td>
<td class="ng-binding">aaaa</td>
<td class="ng-binding">joetester6p</td>
<td class="ng-binding">+16195553164</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">Parvati</td>
<td class="ng-binding">Shallow</td>
<td class="ng-binding">joetester990</td>
<td class="ng-binding">+12015555555</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">hshs</td>
<td class="ng-binding">fff</td>
<td class="ng-binding">joetesterhdhd</td>
<td class="ng-binding">+16195554785</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">test</td>
<td class="ng-binding">test</td>
<td class="ng-binding">joetester234</td>
<td class="ng-binding">+16195551207</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
<tr class="ng-scope" ng-repeat="user in model">
<td class="ng-binding">test</td>
<td class="ng-binding">test</td>
<td class="ng-binding">joetester789</td>
<td class="ng-binding">+16195551207</td>
<td class="ng-binding">
<img class="map-icon" src="../../media/images/google-maps-icon.png" ng-click="viewMap(user.lastKnownPosition.lat, user.lastKnownPosition.lon)">0, 0
</td>
<td class="text-center" ng-click="open(user)"><span class="fa fa-edit"></span>
</td>
</tr>
<!-- end ngRepeat: user in model -->
</tbody>
For example if you want to select joetester24
then the xpath is as follows
//tr[#class='ng-scope']/td[text()='joetester24']
You can try using looping to traverse each element.
var trr = driver.findElements(By.XPath("*//tr[#class='ng-scope']"));
forEach(Iwebelement tr in trr){
var tdd = tr.driver.findElements(By.XPath("*//td[#class='ng-binding']"));
forEach(Iwebelement td in tdd){
if(td.text == "YOUR_MATCHING_TEXT"){// do operations}
// else continue;
}
}
this will take look on each element of your HTML DOM for till your interested element get found
I have the following HTML structure, each tr tag is separated with each other, so when i tried to parse with XPATH, it is supposed to have 2 subitems for just one category, but with my code below it selects all 4 subitems into 1 category, so each category has 4 subitems instead of just 2.
<table class="available">
<tbody>
<tr>
<td class="catname" colspan="2">
<span>Category 1</span>
</td>
</tr>
<tr>
<td rowspan="2" colspan="1" class="itemdetail">
<div class="subname">
SubItem1-1
</div>
</td>
<td class="precioseleccion desgloseth">
<div class="preprice">
<strong class="price">39.99 €</strong>
</div>
</td>
</tr>
<tr>
<td rowspan="2" colspan="1" class="itemdetail">
<div class="subname">
SubItem1-2
</div>
</td>
<td class="precioseleccion desgloseth">
<div class="preprice">
<strong class="price">49.99 €</strong>
</div>
</td>
</tr>
<tr>
<td class="catname" colspan="2">
<span>Category 2</span>
</td>
</tr>
<tr>
<td rowspan="2" colspan="1" class="itemdetail">
<div class="subname">
SubItem2-1
</div>
</td>
<td class="precioseleccion desgloseth">
<div class="preprice">
<strong class="price">59.99 €</strong>
</div>
</td>
</tr>
<tr>
<td rowspan="2" colspan="1" class="itemdetail">
<div class="subname">
SubItem2-2
</div>
</td>
<td class="precioseleccion desgloseth">
<div class="tooltip3">
<strong class="price">69.99 €</strong>
</div>
</td>
</tr>
</tbody>
</table>
var doc = new HtmlDocument(); // with HTML Agility pack
doc.LoadHtml(uricontent);
var rooms = doc.DocumentNode
.SelectNodes("//table[#class='available']//td[#class='catname']")
.Select(r => new
{
Type= r.InnerText.CleanInnerText(),
SubTypes= r.SelectNodes("../..//tr//td[#class='itemdetail']//div[#class='subname']")
.Select(s => new
{
SubType= s.InnerText.CleanInnerText(),
Price =
s.SelectSingleNode(".//parent::td/following-sibling::td[#class='allprice']//div[#class='preprice']//strong[#class='price']")
.InnerText.CleanInnerText()
}).ToArray()
}).ToArray();
If I understand your question correctly, to select all the Categories you want //tr[td[#class='catname']], and to select their sub-items you want following-sibling::tr/td[div[#class='subname']].
I need to parse HTML file with HTML Agility Pack. Here is div with class attribute = divTableBodyText and table inside it. I need to get table's content. I created class for data but don't know how get data.
<html>
<body>
<div class="divTableBodyText">
<table class="tableBodyText fdff_L" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
</td>
</tr>
<tr>
<td>
<span class="fontSize textBold">Выберите тариф.</span> Разница цен в пределах одного
типа тарифа может возникнуть из-за условий выполнения рейса, связанных с колличеством
пересадок и доступностью мест. Цены указаны для взрослого пассажира с учетом Сборов
/ Налогов.
</td>
</tr>
<tr>
<td>
</td>
</tr>
</tbody>
</table>
<div class="FFInfoPanel">
</div>
<table class="fdff_tableFF" cellspacing="0">
<tbody>
<tr>
<th>
</th>
<th>
Тип тарифа
</th>
<th width="55%">
Описание тарифа
</th>
<th>
Минимальная цена
</th>
<th>
Другие авиарейсы
</th>
</tr>
<tr class="">
<td style="background-color: rgb(255, 255, 255); border-right: medium none; padding: 0px 4px 0px 0px;">
</td>
<td class="textBold" width="15%">
Special-Kazakhstan
</td>
<td class="wrap" id="FN_0" width="55%">
Специальный тариф экономического класса с ограничениями <a href="javascript:fareFamilyDescriptionPopUp.redirectToAnExternalPopUp('http://www.airastana.com/int/ru/Fare-Family-Special-Kazakhstan.aspx');">
Дополнительная информация</a>
</td>
<td style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);" class="white"
id="FRB_1_0" _isdisabled="false" width="15%">
<input id="RB0" name="FamilyButton" value="0|1" onclick="javascript:FDFF.selectRecommendationSet('0', true,'0', 'FRB_1_0',false);"
checked="checked" type="radio">
47 917 KZT
</td>
<td class="white" id="FRB_2_0" _isdisabled="" width="15%">
</td>
</tr>
<tr class="bgrd">
<td style="background-color: rgb(255, 255, 255); border-right: medium none; padding: 0px 4px 0px 0px;">
</td>
<td class="textBold" width="15%">
Flexible-Kazakhstan
</td>
<td class="wrap" id="FN_1" width="55%">
Специальный тариф экономического класса с возможностью бесплатного перебронирования
до отправления. <a href="javascript:fareFamilyDescriptionPopUp.redirectToAnExternalPopUp('http://www.airastana.com/int/ru/Fare-Family-Flexible-Kazakhstan.aspx');">
Дополнительная информация</a>
</td>
<td class="white" id="FRB_1_1" _isdisabled="false" width="15%">
<input id="RB1" name="FamilyButton" value="1|1" onclick="javascript:FDFF.selectRecommendationSet('1', true,'1', 'FRB_1_1',false);"
type="radio">
52 397 KZT
</td>
<td class="white" id="FRB_2_1" _isdisabled="" width="15%">
</td>
</tr>
<tr class="">
<td style="background-color: rgb(255, 255, 255); border-right: medium none; padding: 0px 4px 0px 0px;">
</td>
<td class="textBold" width="15%">
Full flexible
</td>
<td class="wrap" id="FN_2" width="55%">
Нормальный тариф экономического класса без ограничений <a href="javascript:fareFamilyDescriptionPopUp.redirectToAnExternalPopUp('http://www.airastana.com/int/ru/Fare-Family-Full-Flexible.aspx');">
Дополнительная информация</a>
</td>
<td class="white" id="FRB_1_2" _isdisabled="false" width="15%">
<input id="RB2" name="FamilyButton" value="2|1" onclick="javascript:FDFF.selectRecommendationSet('2', true,'2', 'FRB_1_2',false);"
type="radio">
56 267 KZT
</td>
<td class="white" id="FRB_2_2" _isdisabled="" width="15%">
</td>
</tr>
<tr class="bgrd">
<td style="background-color: rgb(255, 255, 255); border-right: medium none; padding: 0px 4px 0px 0px;">
</td>
<td class="textBold" width="15%">
Business-Kazakhstan
</td>
<td class="wrap" id="FN_3" width="55%">
Нормальный тариф бизнес класса с некоторыми ограничениями <a href="javascript:fareFamilyDescriptionPopUp.redirectToAnExternalPopUp('http://www.airastana.com/int/ru/Fare-Family-Business-Kazakhstan.aspx');">
Дополнительная информация</a>
</td>
<td class="white" id="FRB_1_3" _isdisabled="false" width="15%">
<input id="RB3" name="FamilyButton" value="3|1" onclick="javascript:FDFF.selectRecommendationSet('3', true,'3', 'FRB_1_3',false);"
type="radio">
89 557 KZT
</td>
<td class="white" id="FRB_2_3" _isdisabled="false" width="15%">
<input name="FamilyButton" value="4|2" onclick="javascript:FDFF.selectRecommendationSet('4', true,'3', 'FRB_2_3',false);"
type="radio">
93 951 KZT
</td>
</tr>
<tr class="">
<td style="background-color: rgb(255, 255, 255); border-right: medium none; padding: 0px 4px 0px 0px;">
</td>
<td class="textBold" width="15%">
Business
</td>
<td class="wrap" id="FN_4" width="55%">
Нормальный тариф бизнес класса без ограничений. Почувствуйте настоящий комфорт!
<a href="javascript:fareFamilyDescriptionPopUp.redirectToAnExternalPopUp('http://www.airastana.com/int/ru/Fare-Family-Business.aspx');">
Дополнительная информация</a>
</td>
<td class="white" id="FRB_1_4" _isdisabled="false" width="15%">
<input id="RB4" name="FamilyButton" value="5|1" onclick="javascript:FDFF.selectRecommendationSet('5', true,'4', 'FRB_1_4',false);"
type="radio">
98 345 KZT
</td>
<td class="white" id="FRB_2_4" _isdisabled="" width="15%">
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
you can try somethink like this maybe it would help
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(//your html document);
foreach (HtmlNode div in doc.DocumentNode.SelectNodes("//div[#class='divTableBodyText']")){
foreach (HtmlNode table in div.DocumentNode.SelectNodes("table")) {
foreach (HtmlNode tbody in div.DocumentNode.SelectNodes("tbody")) {
foreach (HtmlNode row in tbody.SelectNodes("tr")) {
foreach (HtmlNode cell in row.SelectNodes("td")) {
Console.WriteLine(cell.InnerText);
}
}
}
}
}