public void DeleteRecords() { //go to the last page and click Thread.Sleep(1000); LastPage.Click(); Thread.Sleep(1500); //get the maxmun value of the page: //get the text of ul string pageNumber = PageNumber.Text; //split pageNumber into string arr string[] arrPage = pageNumber.Split(Environment.NewLine.ToCharArray()); //browser each page from last page to the first page for (int i = 1; i < int.Parse(arrPage[arrPage.Length - 1]); i++) { //the current page number int pageNow = int.Parse(arrPage[arrPage.Length - 1]) - i + 1; Thread.Sleep(1000); //get the table and tr location var trs = Table.FindElements(By.TagName("tr")); // go through all the tr in table foreach (var tr in trs) { Thread.Sleep(1000); //get td in this tr var tds = tr.FindElements(By.TagName("td")); //get the text of each td and conpare to what you want foreach (var td in tds) { string tdString = td.Text; //find the record row if (tdString == Properties.code) { //click and the alert shows up 相对路径 tr.FindElement(By.XPath(".//td[5]/a[2]")).Click(); //move to alert IAlert iAlert = Properties.driver.SwitchTo().Alert(); //click OK iAlert.Accept(); Console.WriteLine("Delete" + pageNow); Thread.Sleep(1000); return; } } } //go to the previous page PreviousPage.Click(); } }
public void GoToPreviousPage() { if (PreviousPage.isEnabled()) { PreviousPage.Click(); } else { BRLogger.LogInfo("User is on the first page."); } }
public void GoToPreviousPage(int count) { for (int i = 0; i < count; i++) { if (PreviousPage.isEnabled()) { PreviousPage.Click(); } else { BRLogger.LogInfo("User is on the first page."); break; } } }
public void CheckRecords() { //go to the last page and click Thread.Sleep(1000); LastPage.Click(); Thread.Sleep(1500); //get the maxmun value of the page: //get the text of ul string pageNumber = PageNumber.Text; //split pageNumber into string arr string[] arrPage = pageNumber.Split(Environment.NewLine.ToCharArray()); //browser each page from last page to the first page for (int i = 1; i < int.Parse(arrPage[arrPage.Length - 1]); i++) { //the current page number int pageNow = int.Parse(arrPage[arrPage.Length - 1]) - i + 1; Thread.Sleep(1000); //get the table and tr location var trs = Table.FindElements(By.TagName("tr")); // go through all the tr in table foreach (var tr in trs) { //get td in this tr var tds = tr.FindElements(By.TagName("td")); //get the text of each td and conpare to what you want foreach (var td in tds) { string tdString = td.Text; if (tdString == Properties.code) { Console.WriteLine("PASS----Find the input Code on page :" + pageNow); } } } //go to the previous page PreviousPage.Click(); } }
/// <summary> /// previous page /// </summary> public void SelectPreviousPage() { PreviousPage.Click(); }
public FizzBuzzDriver GoToPreviousPage() { PreviousPage.Click(); return(this); }