Example usage for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated

List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated

Introduction

In this page you can find the example usage for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated.

Prototype

public static ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator) 

Source Link

Document

An expectation for checking that an element is present on the DOM of a page and visible.

Usage

From source file:com.contactenergy.Tests.ContactBrowserTest.java

@Test(dataProvider = "devices")
public void ExistingCustomerAddPropertyJourney_onDesktop(TestDevice device) throws IOException, Exception {

    load("/Residential/Electricity/Find-a-Plan/Moving-House");

    Assert.assertTrue("Navigated to Residential Moving House Page",
            driver.get().findElement(By.xpath("//h2[contains(.,'Moving House')]")).isDisplayed());

    scrollto("//h2[contains(.,'Already with Contact?')]");

    driver.get().findElement(By.xpath("//*[@id='app']/div[4]/div[2]/div[1]/div/div/div[2]/div/a")).click();

    Assert.assertTrue("Navigated to Residential Moving House Existing Customer Make-Changes Page", driver.get()
            .findElement(By.xpath("//h2[contains(.,'Hi, what would you like to do today?')]")).isDisplayed());

    driver.get().findElement(By.xpath("//label[contains(.,'Adding a property')]")).click();
    driver.get().findElement(By.xpath("//input[@id='AccountNumber']")).sendKeys("1231312232");
    driver.get().findElement(By.xpath("//label[contains(.,'Enter the address of your additional property')]"))
            .click();//from   www. j  ava 2  s  .  com

    driver.get().findElement(By.xpath("//input[contains(@autocomplete,'off')]"))
            .sendKeys("1 Bressay Way, Waikanae   5036");

    WebDriverWait wait = new WebDriverWait(driver.get(), 15);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='ui-menu-item']")));

    driver.get().findElement(By.xpath("//li[@class='ui-menu-item']")).click();

    driver.get().findElement(By.xpath("//label[contains(@for,'ELEC')]")).click();
    driver.get().findElement(By.xpath("//label[contains(@for,'GAS')]")).click();

    scrollto("//h2[@class='form-subtitle']");
    driver.get().findElement(By.xpath("//label[contains(@for,'Three')]")).click();

    driver.get().findElement(By.xpath("//label[@for='WaterHeatingMethod _Gas']")).click();

    scrollto("//label[@for='WaterHeatingMethod']");
    driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][ElectricityUserType] _Standard']"))
            .click();
    System.out.println(driver.get().findElement(By.cssSelector(".message")).getText());

    scrollto("//h2[@class='recommendedplan-title']");
    driver.get().findElement(By.xpath("//a[@data-filter='FIXED']")).click();

    scrollto("//h2[@class='recommendedplan-title sub']");
    driver.get().findElement(By.xpath("//h2[contains(.,'Certainty Plus')]")).click();

    scrollandclick("//a[@class='btn btn-default plan-progress-btn']");

    if (driver.get().findElement(By.xpath("//h2[contains(.,'About You')]")).isDisplayed()) {
        System.out.println("User on second page filling his details on Move Journey");
    }

    driver.get().findElement(By.xpath("//label[@for='Customer[CustomerInfo][Title] _Mr']")).click();

    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][FirstName]']"))
            .sendKeys("AutoRegression");
    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][LastName]']"))
            .sendKeys("AutoRegression");

    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][EmailAddress]']"))
            .sendKeys("DPTSTTM@contactenergy.co.nz");

    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][PhoneNumber]']"))
            .sendKeys("1231312232");
    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][DateOfBirth]']"))
            .sendKeys("02/06/2002");

    scrollto("//h2[contains(.,'About your property')]");
    driver.get().findElement(By.xpath("//input[@id='Property[MoveInfo][MoveInDate]']")).sendKeys("30/06/2017");

    driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][IsBach]_YES']")).click();

    driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][HasPropertyHazard]_NO']")).click();
    scrollto("//label[@for='Property[PropertyInfo][HasPropertyHazard]_NO']");
    driver.get().findElement(By.xpath("//label[@for='Property[MedicalInfo][HasVulnerablePerson]_NO']")).click();
    driver.get().findElement(By.xpath("//label[@for='Property[MedicalInfo][HasMedicalDependant]_NO']")).click();
    scrollto("//h2[contains(.,'Extra discounts & rewards')]");
    driver.get().findElement(By.xpath("//label[@for='Promotion[PaperlessDiscount]_YES']")).click();
    driver.get().findElement(By.xpath("//label[@for='Promotion[JoinDirectDebit]_NO']")).click();

    scrollandclick("//label[@for='Confirmation-AcceptPlanTermsAndConditions']");
    scrollandclick("//label[@for='Confirmation-AcceptGeneralTermsAndConditions']");

    scrollandclick("//input[@type='submit']");

    Assert.assertTrue("Navigated to Move House Success Page",
            driver.get().findElement(By.xpath("//h1[contains(.,'Thanks!')]")).isDisplayed());
}

From source file:com.contactenergy.Tests.ContactBrowserTest.java

@Test(dataProvider = "devices")
public void ExistingCustomerChangePlanJourney_onDesktop(TestDevice device) throws IOException, Exception {

    load("/Residential/Electricity/Find-a-Plan/Moving-House");

    Assert.assertTrue("Navigated to Residential Moving House Page",
            driver.get().findElement(By.xpath("//h2[contains(.,'Moving House')]")).isDisplayed());

    scrollto("//h2[contains(.,'Already with Contact?')]");

    driver.get().findElement(By.xpath("//*[@id='app']/div[4]/div[2]/div[1]/div/div/div[2]/div/a")).click();

    Assert.assertTrue("Navigated to Residential Moving House Existing Customer Make-Changes Page", driver.get()
            .findElement(By.xpath("//h2[contains(.,'Hi, what would you like to do today?')]")).isDisplayed());

    driver.get().findElement(By.xpath("//label[contains(.,'Changing my plan')]")).click();
    driver.get().findElement(By.xpath("//input[@id='AccountNumber']")).sendKeys("1231312232");
    driver.get().findElement(By.xpath("//label[contains(.,'Enter your address')]")).click();

    driver.get().findElement(By.xpath("//input[contains(@autocomplete,'off')]"))
            .sendKeys("1 Bressay Way, Waikanae   5036");

    WebDriverWait wait = new WebDriverWait(driver.get(), 15);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='ui-menu-item']")));

    driver.get().findElement(By.xpath("//li[@class='ui-menu-item']")).click();

    driver.get().findElement(By.xpath("//label[contains(@for,'ELEC')]")).click();
    driver.get().findElement(By.xpath("//label[contains(@for,'GAS')]")).click();

    scrollto("//h2[@class='form-subtitle']");
    driver.get().findElement(By.xpath("//label[contains(@for,'Three')]")).click();

    driver.get().findElement(By.xpath("//label[@for='WaterHeatingMethod _Gas']")).click();

    scrollto("//label[@for='WaterHeatingMethod']");
    driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][ElectricityUserType] _Standard']"))
            .click();/*  w  w  w .  j a  v  a  2s .  c o  m*/

    System.out.println(driver.get().findElement(By.cssSelector(".message")).getText());

    scrollto("//h2[@class='recommendedplan-title']");
    driver.get().findElement(By.xpath("//a[@data-filter='FIXED']")).click();

    scrollto("//h2[@class='recommendedplan-title sub']");
    driver.get().findElement(By.xpath("//h2[contains(.,'Certainty')]")).click();

    scrollandclick("//a[@class='btn btn-default plan-progress-btn']");

    if (driver.get().findElement(By.xpath("//h2[contains(.,'About You')]")).isDisplayed()) {
        System.out.println("User on second page filling his details on Move Journey");
    }

    driver.get().findElement(By.xpath("//label[@for='Customer[CustomerInfo][Title] _Mr']")).click();

    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][FirstName]']"))
            .sendKeys("AutoRegression");
    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][LastName]']"))
            .sendKeys("AutoRegression");

    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][EmailAddress]']"))
            .sendKeys("DPTSTTM@contactenergy.co.nz");
    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][PhoneNumber]']"))
            .sendKeys("1231312232");
    driver.get().findElement(By.xpath("//input[@id='Customer[CustomerInfo][DateOfBirth]']"))
            .sendKeys("02/06/2002");
    scrollto("//h2[contains(.,'Extra discounts & rewards')]");
    driver.get().findElement(By.xpath("//label[@for='Promotion[PaperlessDiscount]_YES']")).click();
    driver.get().findElement(By.xpath("//label[@for='Promotion[JoinDirectDebit]_NO']")).click();

    scrollandclick("//label[@for='Confirmation-AcceptPlanTermsAndConditions']");

    scrollandclick("//input[@type='submit']");

    Assert.assertTrue("MoveExistingCustomerChangePlanJourney Success Page",
            driver.get().findElement(By.xpath("//h1[contains(.,'Thanks!')]")).isDisplayed());
}

From source file:com.contactenergy.Tests.ContactBrowserTest.java

@Test(dataProvider = "devices")
public void ResidentialOrderBottleGas_onDesktop(TestDevice device) throws IOException, Exception {
    load("/Residential/Gas/Stock-up/Order-Bottled-Gas");

    Assert.assertTrue("Navigated to Residential Bottled Gas Order",
            driver.get().findElement(By.xpath("//h1[contains(.,'Bottled Gas Order')]")).isDisplayed());

    driver.get().findElement(By.xpath("//input[@id='AccountNumber']")).sendKeys("123456789");
    driver.get().findElement(By.xpath("//input[@id='FirstName']")).sendKeys("ResidentialBottleGas");
    driver.get().findElement(By.xpath("//input[@id='LastName']")).sendKeys("AutoRegressionBottleGas");
    driver.get().findElement(By.xpath("//input[@id='EmailAddress']")).sendKeys("DPTSTTM@contactenergy.co.nz");
    driver.get().findElement(By.xpath("//input[@id='PhoneNumber']")).sendKeys("123456789");

    scrollto("//h3[contains(.,'Your Property & Outlet')]");
    driver.get().findElement(By.xpath("//label[contains(.,'Enter your address')]")).click();

    driver.get().findElement(By.xpath("//input[contains(@autocomplete,'off')]"))
            .sendKeys("1 Bressay Way, Waikanae   5036");

    WebDriverWait wait = new WebDriverWait(driver.get(), 15);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='ui-menu-item']")));
    driver.get().findElement(By.xpath("//li[@class='ui-menu-item']")).click();

    selectoption("Region", "North");

    selectoption("Outlet", "FARNORTH");

    scrollto("//legend[contains(.,'Stock Up')]");
    selectoption("NumberOfCylinders", "1");

    driver.get().findElement(By.xpath("//textarea[@id='DeliveryInstructions']"))
            .sendKeys("Auto Regression Test for ordering Residential Bottle Gas");

    // if/*ww w .  j  a  va2 s .  c  o  m*/
    // (!driver.get().findElement(By.xpath("//div[contains(@class,'form-submit-border')]")).isEnabled())
    // {
    // driver.get().findElement(By.xpath("//div[contains(@class,'form-submit-border')]")).click();
    // driver.get().findElement(By.xpath("//input[@type='submit']")).click();
    // } else {

    driver.get().findElement(By.xpath("//input[@type='submit']")).click();
    // }

    Assert.assertTrue("Navigated to Residential Order Bottle Gas Success Page",
            driver.get().findElement(By.xpath("//h1[contains(.,'Thanks!')]")).isDisplayed());
}

From source file:com.contactenergy.Tests.ContactBrowserTest.java

@Test(dataProvider = "devices")
public void BusinessOrderBottleGas_onDesktop(TestDevice device) throws IOException, Exception {
    load("/Business/Order-LPG");

    Assert.assertTrue("Navigated to Business Bottled Gas Order", driver.get()
            .findElement(By.xpath("//legend[contains(.,'Your details and delivery details')]")).isDisplayed());

    driver.get().findElement(By.xpath("//label[contains(.,'Your Account Number')]"));

    driver.get()//ww w  . j  av a  2  s. c  om
            .findElement(
                    By.xpath("//input[@id='wffmb46af2c670fd4482b8e0b9d10755a172_Sections_0__Fields_0__Value']"))
            .sendKeys("123456789");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffmb46af2c670fd4482b8e0b9d10755a172_Sections_0__Fields_1__Value']"))
            .sendKeys("ResidentialBottleGas");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffmb46af2c670fd4482b8e0b9d10755a172_Sections_0__Fields_2__Value']"))
            .sendKeys("DPTSTTM@contactenergy.co.nz");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffmb46af2c670fd4482b8e0b9d10755a172_Sections_0__Fields_3__Value']"))
            .sendKeys("123456789");

    scrollto("//h3[contains(.,'Delivery Address')]");
    driver.get().findElement(By.xpath("//label[contains(.,'Start typing your address')]")).click();

    driver.get().findElement(By.xpath("//input[contains(@autocomplete,'off')]"))
            .sendKeys("1 Bressay Way, Waikanae   5036");

    WebDriverWait wait = new WebDriverWait(driver.get(), 15);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='ui-menu-item']")));
    driver.get().findElement(By.xpath("//li[@class='ui-menu-item']")).click();

    scrollto("//legend[contains(.,'What would you like to order today?')]");
    selectoption("wffmb46af2c670fd4482b8e0b9d10755a172_Sections_1__Fields_0__Value", "Send me 1 cylinder");

    driver.get()
            .findElement(By.xpath(
                    "//textarea[@id='wffmb46af2c670fd4482b8e0b9d10755a172_Sections_1__Fields_1__Value']"))
            .sendKeys("Auto Regression Test for ordering Business Bottle Gas");

    // driver.get().findElement(By.xpath("//fieldset[contains(.,'What would
    // you like to order today?')]")).click();

    // if
    // (!driver.get().findElement(By.xpath("//div[contains(@class,'form-submit-border
    // text-center')]"))
    // .isEnabled()) {
    // driver.get().findElement(By.xpath("//div[contains(@class,'form-submit-border
    // text-center')]")).click();
    // driver.get().findElement(By.xpath("//input[@type='submit']")).click();
    // } else {

    driver.get().findElement(By.xpath("//input[@type='submit']")).click();
    // }

    Assert.assertTrue("Navigated to Business Order Bottle Gas Success Page",
            driver.get().findElement(By.xpath("//h1[contains(.,'Thanks!')]")).isDisplayed());
}

From source file:com.contactenergy.Tests.ContactBrowserTest.java

@Test(dataProvider = "devices")
public void BusinessAddPremisesJourney_onDesktop(TestDevice device) throws IOException, Exception {

    load("/Business/Add-Premises");

    scrollto("//legend[contains(.,'A few details about you')]");

    Assert.assertTrue("Navigated to Business Add Premises Page", driver.get()
            .findElement(By.xpath("//legend[contains(.,'A few details about you')]")).isDisplayed());

    driver.get()/*from w w w . j  ava2  s.  com*/
            .findElement(
                    By.xpath("//input[@id='wffm6a38e4b99016497182c31dade512e220_Sections_0__Fields_0__Value']"))
            .sendKeys("AutoRegression");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm6a38e4b99016497182c31dade512e220_Sections_0__Fields_1__Value']"))
            .sendKeys("AutoRegression");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm6a38e4b99016497182c31dade512e220_Sections_0__Fields_2__Value']"))
            .sendKeys("DPTSTTM@contactenergy.co.nz");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm6a38e4b99016497182c31dade512e220_Sections_0__Fields_3__Value']"))
            .sendKeys("1231312232");

    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm6a38e4b99016497182c31dade512e220_Sections_1__Fields_0__Value']"))
            .sendKeys("1231312232");

    driver.get().findElement(By.xpath("//label[contains(.,'Start typing your address')]")).click();

    driver.get().findElement(By.xpath("//input[contains(@autocomplete,'off')]"))
            .sendKeys("1 Bressay Way, Waikanae   5036");

    WebDriverWait wait = new WebDriverWait(driver.get(), 15);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='ui-menu-item']")));

    driver.get().findElement(By.xpath("//li[@class='ui-menu-item']")).click();

    // driver.get()
    // .findElement(
    // By.xpath("//input[@id='wffm6a38e4b99016497182c31dade512e220_Sections_2__Fields_0__Value']"))
    // .sendKeys("Adding Premises");
    scrollto("//legend[contains(.,'How else can we help you today?')]");
    driver.get()
            .findElement(By.xpath(
                    "//textarea[@id='wffm6a38e4b99016497182c31dade512e220_Sections_2__Fields_0__Value']"))
            .sendKeys("Auto Regression Test for Adding Business Premises");

    selectoption("wffm6a38e4b99016497182c31dade512e220_Sections_2__Fields_1__Value", "Business Freedom");

    scrollandclick("//input[@type='submit']");

    Assert.assertTrue("Navigated to Business Add Premises Success Page",
            driver.get().findElement(By.xpath("//h1[contains(.,'Roger that!')]")).isDisplayed());
}

From source file:com.contactenergy.Tests.ContactBrowserTest.java

@Test(dataProvider = "devices")
public void BusinessMovePremisesJourney_onDesktop(TestDevice device) throws IOException, Exception {

    load("/Business/Move-Premises");

    scrollto("//legend[contains(.,'A few details about you')]");

    Assert.assertTrue("Navigated to Business Add Premises Page", driver.get()
            .findElement(By.xpath("//legend[contains(.,'A few details about you')]")).isDisplayed());

    driver.get()/*from w w  w.j  a v  a 2s  .  c  om*/
            .findElement(
                    By.xpath("//input[@id='wffme6ce7e0dd0744175962be943e5857879_Sections_0__Fields_0__Value']"))
            .sendKeys("AutoRegression");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffme6ce7e0dd0744175962be943e5857879_Sections_0__Fields_1__Value']"))
            .sendKeys("AutoRegression");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffme6ce7e0dd0744175962be943e5857879_Sections_0__Fields_2__Value']"))
            .sendKeys("DPTSTTM@contactenergy.co.nz");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffme6ce7e0dd0744175962be943e5857879_Sections_0__Fields_3__Value']"))
            .sendKeys("1231312232");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffme6ce7e0dd0744175962be943e5857879_Sections_1__Fields_0__Value']"))
            .sendKeys("1231312232");

    driver.get().findElement(By.xpath("//label[contains(.,'Start typing your address')]")).click();

    driver.get().findElement(By.xpath("//input[contains(@autocomplete,'off')]"))
            .sendKeys("1 Bressay Way, Waikanae   5036");

    WebDriverWait wait = new WebDriverWait(driver.get(), 15);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='ui-menu-item']")));

    driver.get().findElement(By.xpath("//li[@class='ui-menu-item']")).click();
    // driver.get()
    // .findElement(
    // By.xpath("//input[@id='wffme6ce7e0dd0744175962be943e5857879_Sections_2__Fields_0__Value']"))
    // .sendKeys("Moving Premises");
    scrollto("//legend[contains(.,'How else can we help you today?')]");
    driver.get()
            .findElement(By.xpath(
                    "//textarea[@id='wffme6ce7e0dd0744175962be943e5857879_Sections_2__Fields_0__Value']"))
            .sendKeys("Auto Regression Test for Moving Business Premises");

    selectoption("wffme6ce7e0dd0744175962be943e5857879_Sections_2__Fields_1__Value", "Business Freedom");

    scrollandclick("//input[@type='submit']");

    Assert.assertTrue("Navigated to Business Move Premises Success Page",
            driver.get().findElement(By.xpath("//h1[contains(.,'Roger that!')]")).isDisplayed());
}

From source file:com.contactenergy.Tests.ContactBrowserTest.java

@Test(dataProvider = "devices")
public void BusinessJoinJourney_onDesktop(TestDevice device) throws IOException, Exception {

    load("/Business/Submit-an-Enquiry");

    scrollto("//legend[contains(.,'A few details about you')]");

    Assert.assertTrue("Navigated to Business Add Premises Page", driver.get()
            .findElement(By.xpath("//legend[contains(.,'A few details about you')]")).isDisplayed());

    driver.get()/*from w  w w.ja va 2  s.co  m*/
            .findElement(
                    By.xpath("//input[@id='wffm0ecdf726e4874fcc90a1ce71dd457dd0_Sections_0__Fields_0__Value']"))
            .sendKeys("AutoRegression");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm0ecdf726e4874fcc90a1ce71dd457dd0_Sections_0__Fields_1__Value']"))
            .sendKeys("AutoRegression");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm0ecdf726e4874fcc90a1ce71dd457dd0_Sections_0__Fields_2__Value']"))
            .sendKeys("DPTSTTM@contactenergy.co.nz");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm0ecdf726e4874fcc90a1ce71dd457dd0_Sections_0__Fields_3__Value']"))
            .sendKeys("1231312232");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm0ecdf726e4874fcc90a1ce71dd457dd0_Sections_1__Fields_0__Value']"))
            .sendKeys("1231312232");
    driver.get().findElement(By.xpath("//label[contains(.,'Start typing your address')]")).click();

    driver.get().findElement(By.xpath("//input[contains(@autocomplete,'off')]"))
            .sendKeys("1 Bressay Way, Waikanae   5036");

    WebDriverWait wait = new WebDriverWait(driver.get(), 15);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='ui-menu-item']")));

    driver.get().findElement(By.xpath("//li[@class='ui-menu-item']")).click();

    scrollto("//legend[contains(.,'How can we help you today?')]");

    selectoption("wffm0ecdf726e4874fcc90a1ce71dd457dd0_Sections_2__Fields_0__Value",
            "Sign up as a business customer");

    driver.get()
            .findElement(By.xpath(
                    "//textarea[@id='wffm0ecdf726e4874fcc90a1ce71dd457dd0_Sections_2__Fields_1__Value']"))
            .sendKeys("Auto Regression Test for Business Join");
    selectoption("wffm0ecdf726e4874fcc90a1ce71dd457dd0_Sections_2__Fields_2__Value",
            "Business Fuel Rewards Plus");

    scrollandclick("//input[@type='submit']");

    Assert.assertTrue("Navigated to Business Join Success Page",
            driver.get().findElement(By.xpath("//h1[contains(.,'Roger that!')]")).isDisplayed());
}

From source file:com.contactenergy.Tests.ContactBrowserTest.java

@Test(dataProvider = "devices")
public void BusinessBottleGasSignUpJourney_onDesktop(TestDevice device) throws IOException, Exception {

    load("/Business/Bottled-Gas-Signup");

    scrollto("//legend[contains(.,'Tell us about your business')]");

    Assert.assertTrue("Navigated to Business SignUp for Order BottleGas Page", driver.get()
            .findElement(By.xpath("//legend[contains(.,'Tell us about your business')]")).isDisplayed());

    driver.get()//ww  w .  j ava 2  s.  co  m
            .findElement(
                    By.xpath("//input[@id='wffm6672788511ce4be19f84d4aea057a2ce_Sections_0__Fields_0__Value']"))
            .sendKeys("AutoRegressionBusiness Bottle Gas");

    driver.get().findElement(By.xpath("//label[contains(.,'Start typing your address')]")).click();

    driver.get().findElement(By.xpath("//input[contains(@autocomplete,'off')]"))
            .sendKeys("1 Bressay Way, Waikanae   5036");

    WebDriverWait wait = new WebDriverWait(driver.get(), 15);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='ui-menu-item']")));

    driver.get().findElement(By.xpath("//li[@class='ui-menu-item']")).click();

    driver.get()
            .findElement(By.xpath(
                    "//textarea[@id='wffm6672788511ce4be19f84d4aea057a2ce_Sections_0__Fields_2__Value']"))
            .sendKeys("Auto Regression Test for Business Order Bottle SignUp");

    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm6672788511ce4be19f84d4aea057a2ce_Sections_1__Fields_0__Value']"))
            .sendKeys("FirstNameAutoRegression");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm6672788511ce4be19f84d4aea057a2ce_Sections_1__Fields_1__Value']"))
            .sendKeys("LastNameAutoRegression");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm6672788511ce4be19f84d4aea057a2ce_Sections_1__Fields_2__Value']"))
            .sendKeys("JobAutoRegression");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm6672788511ce4be19f84d4aea057a2ce_Sections_1__Fields_3__Value']"))
            .sendKeys("DPTSTTM@contactenergy.co.nz");
    driver.get()
            .findElement(
                    By.xpath("//input[@id='wffm6672788511ce4be19f84d4aea057a2ce_Sections_1__Fields_4__Value']"))
            .sendKeys("1231312232");

    selectoption("wffm6672788511ce4be19f84d4aea057a2ce_Sections_1__Fields_5__Value",
            "I'd prefer a call in the morning");

    scrollandclick("//input[@type='submit']");

    Assert.assertTrue("Navigated to Business Bottle Gas Signup Success Page",
            driver.get().findElement(By.xpath("//h1[contains(.,'Roger that!')]")).isDisplayed());
}

From source file:com.denimgroup.threadfix.selenium.pages.ApplicationDetailPage.java

License:Mozilla Public License

public ApplicationDetailPage addNewWaf(String Name, String Type) {
    clickShowDetails();//from  w w w  .j a va2 s.  com
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("appInfoDiv")));
    // TODO should be switched to id
    driver.findElementByLinkText("Add WAF").click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("addWafForm")));
    driver.findElementByLinkText("Create New WAF").click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("createWaf")));
    driver.findElementById("nameInput").sendKeys(Name);
    new Select(driver.findElementById("typeSelect")).selectByVisibleText(Type);
    driver.findElementById("submitTeamModal").click();
    // TODO currently does not allow you to add a waf from application
    // detail page
    return new ApplicationDetailPage(driver);
}

From source file:com.denimgroup.threadfix.selenium.pages.ApplicationDetailPage.java

License:Mozilla Public License

public ApplicationDetailPage addManualFinding(Boolean stat, String cwe, String url, String sourceFile,
        String lineNum, String Parameter, String Severity, String description) {
    driver.findElementById("addManualFindinModalLink").click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("addManualFinding")));
    if (stat) {//  www  . j  a v  a 2s . c o m
        driver.findElementById("staticRadioButton").click();
    }
    driver.findElementById("txtSearch").sendKeys(cwe);
    driver.findElementById("urlDynamicSearch").sendKeys(url);
    driver.findElementById("urlStaticSearch").sendKeys(sourceFile);
    driver.findElementById("urlSearch").sendKeys(lineNum);
    driver.findElementById("parameterInput").sendKeys(Parameter);
    new Select(driver.findElementById("severityInput")).selectByVisibleText(Severity);
    driver.findElementById("descriptionInput").sendKeys(description);
    driver.findElementById("submitDTModal").click();
    wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("addManualFinding")));
    return new ApplicationDetailPage(driver);
}