示例#1
0
 private void ListPlayer(SellPlayerDTO sellPlayerDTO)
 {
     try
     {
         Thread.Sleep(3000);
         var a        = _chromeDriver.FindElements(By.ClassName("sectioned-item-list"))[2];
         var b        = a.FindElement(By.XPath("./.."));
         var newItems = b.FindElements(By.ClassName("listFUTItem"));
         if (newItems?.Count > 0)
         {
             foreach (var player in newItems)
             {
                 _playersHelper.SellPlayer(player, sellPlayerDTO);
             }
         }
         else
         {
             _chromeDriver.OpenTransferTargets(new EaAccount {
                 Username = sellPlayerDTO.Username
             });
             Thread.Sleep(3000);
             var expiredItems = _chromeDriver.FindElements(By.ClassName("expired"));
             if (expiredItems.Count == 0)
             {
                 return;
             }
             foreach (var player in expiredItems)
             {
                 _playersHelper.SellPlayer(player, sellPlayerDTO);
             }
         }
     }
     catch (Exception ex)
     {
         ListPlayer(sellPlayerDTO);
     }
 }
示例#2
0
        public void Sell(SellPlayerDTO sellPlayerDTO, EaAccount eaAccount)
        {
            _chromeDriver.OpenTransferTargets(eaAccount);

            var wonItemsGroup = _chromeDriver.FindElements(By.ClassName("sectioned-item-list"), 10).ToList()[2];
            var itemList      = wonItemsGroup.FindElement(By.ClassName("itemList"));
            var players       = itemList.FindElements(By.ClassName("listFUTItem"));

            try
            {
                foreach (var player in players)
                {
                    _playersHelper.SellPlayer(player, sellPlayerDTO);
                }
            }
            catch (Exception)
            {
                Sell(sellPlayerDTO, eaAccount);
            }
        }