Answer the question
In order to leave comments, you need to log in
Hello guys who worked with selemiun, what's wrong?
private void button2_Click(object sender, EventArgs e)
{
Browser.Navigate().GoToUrl($"https://steamcommunity.com/market/search?appid=730#p1_popular_desc");
//Переключение страницы на торговой площадке Steam и сбор вещей
for (int page = 1; page < 1506; page++)
{
for (int i = 0; i < 10; i++)
{
//File.WriteAllText(@"D:\Users\SunNy\Desktop\resellPrice.txt");
IWebElement SteamContainer = Browser.FindElement(By.Id("searchResultsRows"));
List<IWebElement> Items = SteamContainer.FindElements(By.ClassName("market_listing_row market_recent_listing_row market_listing_searchresult")).ToList();
System.Threading.Thread.Sleep(2000);
Items[i].Click();
String PriceAuto = "";
String PriceDefolt = "";
System.Threading.Thread.Sleep(2000);
List<IWebElement> SellAuto = Browser.FindElements(By.ClassName("market_commodity_buyrequests")).ToList();
// Цена автопокупки
for (int j = 0; j < SellAuto.Count; j++)
{
if (SellAuto[j].Displayed)
{
PriceAuto = SellAuto[j].Text;
String PriceAutoToText = System.Text.RegularExpressions.Regex.Match(PriceAuto, @"[0-9]+\,?[0-9]*").Value;
}
}
List<IWebElement> SellDefolt = Browser.FindElements(By.ClassName("market_commodity_forsale")).ToList();
// Дефолтная цена
for (int x = 0; x < SellDefolt.Count; x++)
{
if (SellDefolt[x].Displayed)
{
PriceDefolt = SellDefolt[x].Text;
String PriceDefoltToText = System.Text.RegularExpressions.Regex.Match(PriceDefolt, @"[0-9]+\,?[0-9]*").Value;
}
}
// Считаем сколько разница между дефолт и автопокупкой
float PriceDifference = Single.Parse(PriceDefolt) - Single.Parse(PriceAuto);
Console.WriteLine(PriceDifference);
}
System.Threading.Thread.Sleep(1000);
IWebElement pageSteam;
pageSteam = Browser.FindElement(By.Id("searchResults_btn_next"));
pageSteam.Click();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question