Ejemplo n.º 1
0
        /// <summary>
        /// Click the 'Show Me' button for the specified make and model.
        /// </summary>
        /// <param name="make">
        /// A car make name.
        /// </param>
        /// <param name="model">
        /// A car model name.
        /// </param>
        /// <returns>
        /// Reference to a search results page object.
        /// </returns>
        public Page ClickShowMeButton(string make, string model)
        {
            /*
             * Replace characters to match the application url for the search page.
             */
            make  = make.Replace(' ', '-');
            make  = make.Replace('/', '-');
            model = model.Replace(' ', '-');
            model = model.Replace('/', '-');

            /*
             * Wait for the 'Show Me' button text to contain the number of matched vehicles using a regular expression;
             * matching zero vehicles will cause a timeout exception.
             */
            SeleniumTestUtils.WaitForElementTextToMatch(driver, elementTimeout, By.XPath("//span[@class='totalRecordsText']"), "^[1-9][0-9]+$");

            SeleniumTestUtils.Click(driver, elementTimeout, showMeButton);

            SeleniumTestUtils.WaitForUrlToMatch(driver, pageTimeout, $".*{make}.*{model}.*");
            return(PageFactory.Instance.GetPage(driver, driver.Url, PageFactory.SEARCH_RESULTS_PAGE, pageTimeout, elementTimeout));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Click the page next button.
 /// </summary>
 /// <returns>
 /// A reference to the next page object.
 /// </returns>
 public Page Click_Next_Button()
 {
     SeleniumTestUtils.Click(driver, elementTimeout, nextButton);
     SeleniumTestUtils.WaitForUrl(driver, pageTimeout, TestUtils.AppendUrl(GetBaseUrl(), PageFactory.CARS_FOR_SALE2));
     return((CarsForSale2Page)PageFactory.Instance.GetPage(driver, GetBaseUrl(), PageFactory.CARS_FOR_SALE2, pageTimeout, elementTimeout));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Click on the 'Used Cars for Sale' menu item.
 /// </summary>
 /// <returns>
 /// A reference to the initial 'Cars For Sale' page object.
 /// </returns>
 public CarsForSale1Page ClickUsedCarsForSaleMenu()
 {
     SeleniumTestUtils.Click(driver, elementTimeout, usedCarsForSaleMenu);
     SeleniumTestUtils.WaitForUrl(driver, pageTimeout, TestUtils.AppendUrl(GetBaseUrl(), PageFactory.CARS_FOR_SALE1));
     return((CarsForSale1Page)PageFactory.Instance.GetPage(driver, GetBaseUrl(), PageFactory.CARS_FOR_SALE1, pageTimeout, elementTimeout));
 }