public virtual void CheckSearch() { foreach (var drl in SearchFormDropDowns) { SeleniumSetMethods.SelectDropDown(drl, 1); SeleniumGetMethod.WaitForPageLoad(driver); Thread.Sleep(2000); } foreach (var field in SearchFormInputs) { field.SendKeys(Helpers.Randomizer.String(7)); } SeleniumGetMethod.WaitForPageLoad(driver); Thread.Sleep(3000); for (int i = 0; i < SearchFormCreatedDate.Count; i++) { SeleniumGetMethod.WaitForElement(driver, SearchFormCreatedDate[i]); SearchFormCreatedDate[i].Click(); try { foreach (var date in CalendarBoxFromTo) { if (date.Displayed) { date.Clear(); date.SendKeys(WindowsMessages.GetCurDate(1)); SeleniumGetMethod.WaitForPageLoad(driver); } } if (BtnApply[i].Displayed) { SeleniumGetMethod.WaitForElement(driver, BtnApply[i]); BtnApply[i].Click(); SeleniumGetMethod.WaitForPageLoad(driver); Thread.Sleep(1000); SeleniumGetMethod.WaitForPageLoad(driver); } } catch (Exception msg) { PropertiesCollection._reportingTasks.Log(Status.Info, "Can't manipulate calendarboxes..<br>" + msg.ToString()); } } Thread.Sleep(2000); BtnSearch.Click(); SeleniumGetMethod.WaitForPageLoad(driver); Thread.Sleep(2000); try { xClearAllFilters.Click(); Thread.Sleep(2000); } catch (Exception msg) { PropertiesCollection._reportingTasks.Log(Status.Info, "Can't set null filters uisng x(cross) link...<br>" + msg.ToString()); } SeleniumGetMethod.WaitForPageLoad(driver); }
public void OpenTargetSubfolder(IWebElement folderToOpen, IList <IWebElement> folderItems, int indexItemToOpen) { SeleniumGetMethod.WaitForPageLoad(PropertiesCollection.driver); //(new Actions(PropertiesCollection.driver)).MoveToElement(folderToOpen).Perform(); folderToOpen.Click(); SeleniumGetMethod.WaitForElement(PropertiesCollection.driver, folderItems.Last()); PropertiesCollection._reportingTasks.Log(Status.Info, "<b> Folder to open: </b>: " + "<h5>" + folderToOpen.Text + " ---> " + folderItems[indexItemToOpen].Text + "</h5>"); folderItems[indexItemToOpen].Click(); SeleniumGetMethod.WaitForPageLoad(PropertiesCollection.driver); Thread.Sleep(2000); }
public virtual void CheckSort() { IList <IWebElement> gridHeaders = driver.FindElements(By.CssSelector("tr.jsgrid-header-row > th[class*=sortable]> div > div.text-ellipsis > span")); //ASC for (int i = 0; i < gridHeaders.Count; i++) { SeleniumGetMethod.WaitForElement(driver, gridHeaders[i]); gridHeaders[i].Click(); SeleniumGetMethod.WaitForPageLoad(driver); SeleniumGetMethod.WaitForElement(driver, gridHeaders[i]); Thread.Sleep(2000); //DESC gridHeaders[i].Click(); SeleniumGetMethod.WaitForPageLoad(driver); SeleniumGetMethod.WaitForElement(driver, gridHeaders[i]); Thread.Sleep(2000); var text = gridHeaders[i].GetAttribute("textContent"); PropertiesCollection._reportingTasks.Log(Status.Info, "Sort by column" + " " + (i + 1) + " column name is " + text); } }
public void CheckPaging(PagingData data) { IWebElement recordsFound = PropertiesCollection.driver.FindElement(By.CssSelector(data.recordsFound)); IWebElement dropdownSelectPerPage = PropertiesCollection.driver.FindElement(By.CssSelector(data.dropdownSelectPerPage)); IWebElement pagesaQua = PropertiesCollection.driver.FindElement(By.CssSelector(data.pagesQua)); //check logic int selectedValue = SelectPerPage(data, dropdownSelectPerPage); SeleniumGetMethod.WaitForPageLoad(PropertiesCollection.driver); Thread.Sleep(2000); IList <IWebElement> tableRecors = PropertiesCollection.driver.FindElements(By.CssSelector(data.tableRecors)); int records = GetTableRecords(tableRecors); PropertiesCollection._reportingTasks.Log(Status.Info, "Selected per page value : " + selectedValue + "<br>" + "There are records in the grid...: " + records); try { Assert.IsTrue(selectedValue == records, "Paging doesn't work properly!!!"); } catch (Exception message) { PropertiesCollection._reportingTasks.Log(Status.Info, "paging works wrong, try catch works" + "<br>" + message.ToString()); } int numberPages = GetPagesQuantity(data); /*string quatLabel = PageOfPagesLogic(data).ToString(); * Assert.IsTrue(quatLabel == $"1 of {numberPages}", "Paging doesn't work properly - smth wrong with label..."); * PropertiesCollection._reportingTasks.Log(Status.Info, "LABEL VALUE : " + quatLabel);*/ if (numberPages == 0) { PropertiesCollection._reportingTasks.Log(Status.Warning, "Number of pages returns 0 so it's impossible to test paging here..."); return; } if (numberPages == 1) { PropertiesCollection._reportingTasks.Log(Status.Info, "There is only 1 page..."); } if (1 < numberPages && numberPages <= 3) { for (int i = 1; i < numberPages; i++) { IWebElement nextPge = PropertiesCollection.driver.FindElement(By.CssSelector(data.nextPage)); SeleniumGetMethod.WaitForElement(PropertiesCollection.driver, nextPge); nextPge.Click(); SeleniumGetMethod.WaitForPageLoad(PropertiesCollection.driver); Thread.Sleep(2000); } /* quatLabel = PageOfPagesLogic(data).ToString(); * PropertiesCollection._reportingTasks.Log(Status.Info, "label LOOP value : " + quatLabel); * Assert.IsTrue(quatLabel == $"{numberPages} of {numberPages}", "Paging doesn't work properly - smth wrong with label...loop..");*/ for (int count = numberPages; count > 1; count--) { IWebElement prevPage = PropertiesCollection.driver.FindElement(By.CssSelector(data.prevPage)); SeleniumGetMethod.WaitForElement(PropertiesCollection.driver, prevPage); prevPage.Click(); SeleniumGetMethod.WaitForPageLoad(PropertiesCollection.driver); Thread.Sleep(2000); } /*quatLabel = PageOfPagesLogic(data).ToString(); * Assert.IsTrue(quatLabel == $"{1} of {numberPages}", "Paging doesn't work properly - smth wrong with label...loop.."); * PropertiesCollection._reportingTasks.Log(Status.Info, "label LOOP value : " + quatLabel);*/ } //if (numberPages >= 3) if (numberPages > 3) { numberPages = 4; for (int i = 1; i < numberPages; i++) { IWebElement nextPge = PropertiesCollection.driver.FindElement(By.CssSelector(data.nextPage)); nextPge.Click(); SeleniumGetMethod.WaitForPageLoad(PropertiesCollection.driver); Thread.Sleep(2000); } for (numberPages = 4; numberPages > 1; numberPages--) { IWebElement prevPage = PropertiesCollection.driver.FindElement(By.CssSelector(data.prevPage)); SeleniumGetMethod.WaitForElement(PropertiesCollection.driver, prevPage); prevPage.Click(); SeleniumGetMethod.WaitForPageLoad(PropertiesCollection.driver); Thread.Sleep(2000); } } IWebElement lastPage = PropertiesCollection.driver.FindElement(By.CssSelector(data.lastPage)); SeleniumGetMethod.WaitForElement(PropertiesCollection.driver, lastPage); lastPage.Click(); Thread.Sleep(2000); /*quatLabel = PageOfPagesLogic(data).ToString(); * Assert.IsTrue(quatLabel == $"{numberPages} of {numberPages}", "Paging doesn't work properly - smth wrong with label...");*/ IWebElement firstPage = PropertiesCollection.driver.FindElement(By.CssSelector(data.firstPage)); SeleniumGetMethod.WaitForElement(PropertiesCollection.driver, firstPage); firstPage.Click(); /*quatLabel = PageOfPagesLogic(data).ToString(); * Assert.IsTrue(quatLabel == $"1 of {numberPages}", "Paging doesn't work properly - smth wrong with label...");*/ SeleniumGetMethod.WaitForPageLoad(PropertiesCollection.driver); }