AM.Physician.AddNewPhysician.java Source code

Java tutorial

Introduction

Here is the source code for AM.Physician.AddNewPhysician.java

Source

package AM.Physician;

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

import components.Waits;

public class AddNewPhysician {

    private static WebElement element = null;
    private static Select list = null;

    // @ Test Objects for add new physician screen
    // @ Objects under Add Physician
    public static WebElement txt_AP_PhysicianLastName(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianLastName"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_PhysicianFirstName(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianFirstName"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_PhysicianSuffix(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianSuffix"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_PhysicianUPIN(WebDriver driver) {
        element = driver.findElement(By.id("M0072"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_PhysicianNPI(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianNPI"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_PhysicianLicense(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianStateID"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    //TODO License Expiration date picker

    public static WebElement txt_AP_CommunityCareNumber(WebDriver driver) {
        element = driver.findElement(By.id("CommunityCareID"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_ContactPerson(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianContact"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_Address(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianAddressOne"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_ZIPCode(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianZIPCode"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_ZIPCodePlus4(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianZIPCodePlus4"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_City(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianCity"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_State(WebDriver driver) {
        element = driver.findElement(By.id("PhysicianState"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_PhoneA(WebDriver driver) {
        element = driver.findElement(By.id("Physicianphonea"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_PhoneB(WebDriver driver) {
        element = driver.findElement(By.id("Physicianphoneb"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_PhoneC(WebDriver driver) {
        element = driver.findElement(By.id("Physicianphonec"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_FaxA(WebDriver driver) {
        element = driver.findElement(By.id("Physicianfacsimilea"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_FaxB(WebDriver driver) {
        element = driver.findElement(By.id("Physicianfacsimileb"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_FaxC(WebDriver driver) {
        element = driver.findElement(By.id("Physicianfacsimilec"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement txt_AP_PhysicianContactEmail(WebDriver driver) {
        element = driver.findElement(By.id("physicianEmail"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement chk_AP_ExternalReferral(WebDriver driver) {
        element = driver.findElement(By.id("ExternalReferral"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static Select lst_AP_InternalReferralSource(WebDriver driver) {
        element = driver.findElement(By.id("fClinicUserKeyInternalReferral"));
        list = new Select(driver.findElement(By.id("fClinicUserKeyInternalReferral")));
        Waits.ForElementVisibility(driver, element);
        return list;
    }

    public static WebElement txt_AP_AlternateAddress(WebDriver driver) {
        element = driver.findElement(By.id("altAddr"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    public static WebElement btn_AddPhysician(WebDriver driver) {
        element = driver.findElement(By.id("submitBtn"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

    //Internal Liaison
    public static Select lst_AP_InternalLiaison(WebDriver driver) {
        element = driver.findElement(By.xpath("//*[@id='PhysicianForm']/div[2]/div[4]/ul/li/select"));
        list = new Select(driver.findElement(By.xpath("//*[@id='PhysicianForm']/div[2]/div[4]/ul/li/select")));
        Waits.ForElementVisibility(driver, element);
        return list;
    }

    //Comments
    public static WebElement txt_AP_Comments(WebDriver driver) {
        element = driver.findElement(By.xpath("//*[@id='PhysicianForm']/div[2]/div[6]/ul/textarea"));
        Waits.ForElementVisibility(driver, element);
        return element;
    }

}