Status page can be shown , a lot of refactoring is still required
This commit is contained in:
68
StockDAL/StockScrapePage.cs
Normal file
68
StockDAL/StockScrapePage.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using BrowserHelper.Driver;
|
||||
using BrowserHelper.Extensions;
|
||||
using BrowserHelper.Settings;
|
||||
using DataDomain;
|
||||
using OpenQA.Selenium;
|
||||
using StockDAL.Interface;
|
||||
|
||||
namespace StockDAL
|
||||
{
|
||||
|
||||
public class StockScrapePage : IStockScrapePage
|
||||
{
|
||||
private readonly IWebDriver _driver;
|
||||
private readonly TestSettings _testSettings;
|
||||
|
||||
public StockScrapePage(IDriverFixture driver, TestSettings testSettings)
|
||||
{
|
||||
_driver = driver.Driver;
|
||||
_testSettings = testSettings;
|
||||
}
|
||||
|
||||
//IWebElement lnkProduct => _driver.FindElement(By.LinkText("Product"));
|
||||
//IWebElement lnkCreate => _driver.FindElement(By.LinkText("Create"));
|
||||
//IWebElement tblList => _driver.FindElement(By.CssSelector(".table"));
|
||||
|
||||
|
||||
IWebElement tblList => _driver.FindElement(By.ClassName("millistream-list-table"));
|
||||
IWebElement chooseList => _driver.FindElement(By.Id("listselect"));
|
||||
|
||||
public List<DiTraderStockRow> GetMyStockStatus(string listText)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
chooseList.SelectDropDownByText(listText);
|
||||
Thread.Sleep(3000);
|
||||
var stockList = tblList.GetCertainStocks(_testSettings.StockWishes, _testSettings.StocWishCols);
|
||||
//foreach (var stock in stockList)
|
||||
//{
|
||||
// Console.WriteLine($"Aktie: {stock.StockName} Senastepris: {stock.LatestPrice} TidPunkt {stock.TimeOfDay}");
|
||||
//}
|
||||
return stockList;
|
||||
}
|
||||
|
||||
public void GetStocksPerList(string listText)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
chooseList.SelectDropDownByText(listText);
|
||||
Thread.Sleep(3000);
|
||||
var stocklist = tblList.ReadHandledStock();
|
||||
string result = string.Empty;
|
||||
foreach (var stock in stocklist)
|
||||
{
|
||||
result += $"{listText}: {stock.ColumnValue} {System.Environment.NewLine}";
|
||||
}
|
||||
File.WriteAllText($"Aktier_{listText}.txt", result);
|
||||
}
|
||||
|
||||
//public void CreateProduct()
|
||||
//{
|
||||
// lnkProduct.Click();
|
||||
// lnkCreate.Click();
|
||||
//}
|
||||
|
||||
public void PerformClickOnSpecialValue(string name, string operation)
|
||||
{
|
||||
tblList.PerformActionOnCell("1", "Aktie", name, operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user