I am getting an error message when running a small bit of code saying that the input string was not in a correct formate. The issue is coming from when parsing these html
Mark up One
<td class="tdRow1Color" width="100%">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td class="plaintextbold">Item Number: 1258</td></tr>
<tr><td><img alt="" src="images/clear.gif" width="1" height="10" border="0"></td></tr>
<tr>
<td class="plaintext" valign="middle"> <img src="../images/0note.gif" border="0" align="absmiddle"> <a class="prodlink" href="writeReview.asp?number=1258"><i><u>Be the first to review this item</u></i></a></td>
</tr>
<tr><td><img alt="" src="images/clear.gif" width="1" height="10" border="0"></td></tr>
<tr><td class="plaintext"><b>RRP £50.00 - Now £39.99</b> </td>
Mark up Two
<tr><td class="tdRow1Color" width="100%">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td class="plaintextbold">Item Number: 2525</td></tr>
<tr><td><img alt="" src="images/clear.gif" width="1" height="10" border="0"></td></tr>
<tr>
<td class="plaintext" valign="middle"> <img src="../images/0note.gif" border="0" align="absmiddle"> <a class="prodlink" href="writeReview.asp?number=2525"><i><u>Be the first to review this item</u></i></a></td>
</tr>
<tr><td><img alt="" src="images/clear.gif" width="1" height="10" border="0"></td></tr>
<tr><td class="plaintext">RRP £45 - Now £38
I am coverting the RRP price through this regex.
private Regex _originalPriceRegex = new Regex(@"RRP \s(\d+\.?\d+?)");
And picking up the RRP prices through the xpath
ProductProperties.priceOriginal, new HtmlElementLocator("//td[@class='tdRow1Color']//td[@class='plaintext']//text()[starts-with(., 'RRP')]",
The issue seems to be arrive when the xpath value is passed into the functio below. The exception is being thrown when it returns priceMatch.Groups[1].Value
private string LookForOrignalPrice(HtmlNode node)
{
string text = node.InnerText;
Match priceMatch = _originalPriceRegex.Match(text);
if (priceMatch.Success)
Console.WriteLine("++++++price is " + priceMatch);
return priceMatch.Groups[1].Value;
return null;
}
Thanks for any advice which you can give.