Trying some bugfix (scraping)
This commit is contained in:
@ -136,25 +136,31 @@ namespace BrowserHelper.Extensions
|
||||
//GlobalStopwatch.PrintSecs("Before scraplooping");
|
||||
foreach (var row in rows)
|
||||
{
|
||||
var element = row.FindElement(By.XPath(".//td"));
|
||||
if (!shareSet.Contains(element.Text)) { }
|
||||
else
|
||||
try
|
||||
{
|
||||
var colDatas = row.FindElements(By.TagName("td"));
|
||||
if (colDatas.Count != 0 && shares.Contains(colDatas[0].Text))
|
||||
var element = row.FindElement(By.XPath(".//td"));
|
||||
if (!shareSet.Contains(element.Text)) { }
|
||||
else
|
||||
{
|
||||
shareCollection.Add(new DiTraderStockRow
|
||||
var colDatas = row.FindElements(By.TagName("td"));
|
||||
if (colDatas.Count != 0 && shares.Contains(colDatas[0].Text))
|
||||
{
|
||||
StockName = colDatas[columnPos["Aktie"]].Text,
|
||||
LatestPrice = decimal.Parse(colDatas[columnPos["Senast"]].Text==""?"-0,1": colDatas[columnPos["Senast"]].Text),
|
||||
TimeOfDay = TimeSpan.Parse(colDatas[columnPos["Tid"]].Text)
|
||||
});
|
||||
shareCollection.Add(new DiTraderStockRow
|
||||
{
|
||||
StockName = colDatas[columnPos["Aktie"]].Text,
|
||||
LatestPrice = decimal.Parse(colDatas[columnPos["Senast"]].Text == "" ? "-0,1" : colDatas[columnPos["Senast"]].Text),
|
||||
TimeOfDay = TimeSpan.Parse(colDatas[columnPos["Tid"]].Text)
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
//antal--;
|
||||
shareSet.Remove(element.Text);
|
||||
rowIndex++;
|
||||
//antal--;
|
||||
shareSet.Remove(element.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
//if (antal < 1) break;
|
||||
if (shareSet.Count < 1) break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user