Trying some bugfix (scraping)

This commit is contained in:
2022-09-16 12:23:25 +02:00
parent eb65cead16
commit a9cd3630a0

View File

@ -135,6 +135,8 @@ namespace BrowserHelper.Extensions
int rowIndex = 0; int rowIndex = 0;
//GlobalStopwatch.PrintSecs("Before scraplooping"); //GlobalStopwatch.PrintSecs("Before scraplooping");
foreach (var row in rows) foreach (var row in rows)
{
try
{ {
var element = row.FindElement(By.XPath(".//td")); var element = row.FindElement(By.XPath(".//td"));
if (!shareSet.Contains(element.Text)) { } if (!shareSet.Contains(element.Text)) { }
@ -146,7 +148,7 @@ namespace BrowserHelper.Extensions
shareCollection.Add(new DiTraderStockRow shareCollection.Add(new DiTraderStockRow
{ {
StockName = colDatas[columnPos["Aktie"]].Text, StockName = colDatas[columnPos["Aktie"]].Text,
LatestPrice = decimal.Parse(colDatas[columnPos["Senast"]].Text==""?"-0,1": colDatas[columnPos["Senast"]].Text), LatestPrice = decimal.Parse(colDatas[columnPos["Senast"]].Text == "" ? "-0,1" : colDatas[columnPos["Senast"]].Text),
TimeOfDay = TimeSpan.Parse(colDatas[columnPos["Tid"]].Text) TimeOfDay = TimeSpan.Parse(colDatas[columnPos["Tid"]].Text)
}); });
@ -155,6 +157,10 @@ namespace BrowserHelper.Extensions
shareSet.Remove(element.Text); shareSet.Remove(element.Text);
} }
} }
}
catch (Exception)
{
}
//if (antal < 1) break; //if (antal < 1) break;
if (shareSet.Count < 1) break; if (shareSet.Count < 1) break;
} }