Powered By Blogger

Search Here!

Thursday, April 26, 2012

Selenium RC: Search Text using Pagination !

Sometimes, we want to search a value in absence of search function due to it's not implemented. There is a problem through Selenium to get the value in a table that contains pagination. This method helps you to find search value from the table using pagination.  tableName is the Table locator and searchText is the name of the text that you want to search.


        public static int SearchTextFromPaginationGrid(string tableName, string searchText)
        {
            ISelenium Selenium = GetSeleniumInstance();
            int table_employee;
            string gridID = string.Empty; ;
            bool value = true;
            do
            {
                string get_text = Selenium.GetText(gridIDLoc);
                 table_employee  = get_text.IndexOf(searchText);
                if (gridIDLoc.Contains("'"))
                {
                    string[] SplittedLoc = gridIDLoc.Split('\'');
                    gridID = SplittedLoc[1];
                }
                value = Selenium.IsElementPresent("id=" + gridID + "$next");
                if (value == true)
                {
                    Selenium.Click("id=" + gridID + "$next");
                    Thread.Sleep(2000);
                }
                WaitUntilElement(gridID);
            } while (value && table_txt < 0);
            return  table_employee;
        }

1 comment:

  1. tu te char pai alla dekhe eeee... ye kesi teri khud garzi.. he kabira manja.. hey fakira man ja what the fuuucckira..

    ReplyDelete