All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pages.nopcommerce.ProductDetailsPage Maven / Gradle / Ivy

Go to download

An open-source Selenium Java-based Test automation Framework that allows you to perform multiple actions to test a web application's functionality, behaviour, which provides easy to use syntax, and easy to set up environment according to the needed requirements for testing

There is a newer version: 1.1.1
Show newest version
package pages.nopcommerce;

import driverfactory.webdriver.WebDriver;
import org.openqa.selenium.By;

public class ProductDetailsPage{

    private final WebDriver driver;

    By productNameBreadCrumb = By.cssSelector("strong.current-item");
    By emailButton = By.cssSelector("button.button-2.email-a-friend-button");
    By productPriceLabel = By.id("price-value-4");
    By reviewHyperlink = By.xpath("//a[@href=\"/productreviews/4\"][2]");

    public ProductDetailsPage(WebDriver driver) {
        this.driver = driver;
    }

    public ProductDetailsPage checkThatProductPageShouldBeDisplayed(String productName){
        driver.assertThat().element(productNameBreadCrumb).text().isEqualTo(productName);
        return this;
    }

    public EmailFriendPage emailFriend()
    {
        driver.element().click(emailButton);
        return new EmailFriendPage(driver);
    }


    public ProductReviewPage addReview()
    {
        driver.element().click(reviewHyperlink);
        return new ProductReviewPage(driver);
    }

    public ProductDetailsPage checkCurrency(String currency)
    {
        driver.assertThat().element(productPriceLabel).text().contains(currency);
        return this;
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy