package com.example.pageobjects.pakistan;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;


public class PublicationPage {
    public WebDriver driver;

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

    public WebElement pageHeader(String pageHeader) {
        return driver.findElement(By.xpath(String.format("//a[normalize-space()='%s']", pageHeader)));
    }

    public void publicationType(String type) {
        Select publicationType = new Select(driver.findElement(By.xpath("//select[@name='for']")));
        publicationType.selectByVisibleText(type);
    }

    public WebElement email() {
        return driver.findElement(By.cssSelector("#email"));
    }

    public WebElement searchButton() {
        return driver.findElement(By.cssSelector("button[class='btn search-button']"));
    }

    public WebElement searchFieldLocator() {
        return driver.findElement(By.xpath("//input[@placeholder='Click to Search']"));
    }
}
