コード例 #1
0
 internal void Next(ref IWebDriver Drv, int secWait)
 {
     try
     {
         WebDriverWait ww      = new WebDriverWait(Drv, TimeSpan.FromSeconds(secWait));
         int           count   = AddToolsSe.getXpathCount(@"//ul/li", ref Drv);
         IWebElement   nexPage = ww.Until(ExpectedConditions.ElementToBeClickable(By.XPath($"//ul/li[{count}]")));
         nexPage.Click();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #2
0
 internal string SubStrAttrTopLastRow(ref IWebDriver Drv, string nameAttr, string firstPointAttr, int amountFirstSymb, string secondPointAttr, int amountSecondSymb)
 {
     try
     {
         //account all last row
         int         res          = AddToolsSe.getXpathCount(@"//div[@aria-label='row']", ref Drv);
         string      lastXpathRow = String.Format(@"//div[@class='Xxx__Table']/div/div/div[{0}]", res);
         IWebElement Last         = Drv.FindElement(By.XPath(lastXpathRow));
         return(GetAttrSubStr(ref Last, nameAttr, firstPointAttr, amountFirstSymb, secondPointAttr, amountSecondSymb));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         return(null);
     }
 }
コード例 #3
0
        internal void ScrollDownListZdobuvachiv(ref int FinishRow, ref IWebDriver Drv)
        {
            //scroll inside div ajax selenium
            try
            {
                if (FinishRow == 0)
                {
                    FinishRow = 870;
                }
                //atribute if row with data
                string firstPartText      = "//div[@style='height: 0px; left: 0px; position: absolute; top: ";
                string lastPartText       = "px; width: 100px; overflow: hidden; padding-right: 17px;']";
                string xPathRowTableBegin = String.Format(@"{0}{1}{2}", firstPartText, FinishRow, lastPartText);
                //heigth of row 30 px
                const int heightRow     = 00;
                int       nextFinishRow = ((AddToolsSe.getXpathCount(@"//div[@aria-label='row']", ref Drv) - 1) * heightRow) + FinishRow;
                if (nextFinishRow >= 0000)
                {
                    nextFinishRow = 0000;
                }
                //MessageBox.Show(getXpathCount("//div[@aria-label='row']").ToString());
                string xPathRowTableEnd = String.Format(@"{0}{1}{2}", firstPartText, nextFinishRow, lastPartText);

                AddToolsSe.ScrollToView(By.XPath(xPathRowTableBegin), ref Drv);
                WebDriverWait wait = new WebDriverWait(Drv, TimeSpan.FromSeconds(5));
                // wait for a new element at the end
                wait.Until((ExpectedConditions.ElementIsVisible(By.XPath(xPathRowTableEnd))));
                ///
                if (FinishRow < 0000)
                {
                    FinishRow = nextFinishRow;
                }
                else
                {
                    MessageBox.Show(FinishRow.ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }