com.solidmaps.test.po.LicenseExercitoListPO.java Source code

Java tutorial

Introduction

Here is the source code for com.solidmaps.test.po.LicenseExercitoListPO.java

Source

package com.solidmaps.test.po;

import org.openqa.selenium.By;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import com.solidmaps.test.utils.URLUtils;

public class LicenseExercitoListPO {

    public static final String URL = URLUtils.getContextPath() + "/admin/license/ex/list.do";

    private RemoteWebDriver driver;

    public LicenseExercitoListPO(RemoteWebDriver driver) {
        this.driver = driver;
    }

    public LicenseExercitoListPO open() {

        driver.get(LicenseExercitoListPO.URL);

        return this;

    }

    public LicenseExercitoListPO delete(String idLicense) {

        driver.findElement(By.id("check_" + idLicense)).click();
        driver.findElement(By.id("btnExcluir")).click();
        driver.switchTo().alert().accept();

        (new WebDriverWait(driver, 10))
                .until(ExpectedConditions.presenceOfElementLocated(By.id("form-list-license")));

        return this;

    }

    public LicenseExercitoInsertPO update(String idLicense) {

        driver.findElement(By.id("line_" + idLicense)).click();

        (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By.id("idLicense")));

        return new LicenseExercitoInsertPO(driver);

    }

    public LicenseExercitoInsertPO addLicense() {
        driver.findElement(By.id("btnAdd")).click();

        return new LicenseExercitoInsertPO(driver);
    }

}