List of usage examples for org.openqa.selenium.support.ui WebDriverWait WebDriverWait
public WebDriverWait(WebDriver driver, Duration timeout)
From source file:com.comcast.dawg.selenium.SeleniumWaiter.java
License:Apache License
/** * It will wait till the presence of element on the DOM. If wait time go beyond to expected * timeout it will throw time out exception. * * @param locatorName element locator. * @param timeoutInSec timeout in seconds. * * @return The functions' return value if the function returned something different from null * or false before the timeout expired. *///from w w w . jav a2s . c o m public WebElement waitForPresence(By locatorName, int timeoutInSec) { WebDriverWait wait = new WebDriverWait(driver, timeoutInSec); return wait.until(ExpectedConditions.presenceOfElementLocated(locatorName)); }
From source file:com.comcast.dawg.selenium.SeleniumWaiter.java
License:Apache License
/** * Wait until an element is no longer attached to the DOM. * * @param element The element to wait for. * @param timeoutInSec timeout in seconds. * * @return false is the element is still attached to the DOM, true otherwise. *///from w ww . j av a 2 s. c om public boolean waitForStaleness(WebElement element, int timeoutInSec) { WebDriverWait wait = new WebDriverWait(driver, timeoutInSec); return wait.until(ExpectedConditions.stalenessOf(element)); }
From source file:com.comcast.dawg.selenium.SeleniumWaiter.java
License:Apache License
/** * Wait for the presence of alert.//from w ww.j a va 2 s .co m * * @param timeoutInSec timeout in seconds. */ public void waitForAlertPresence(int timeoutInSec) { WebDriverWait wait = new WebDriverWait(driver, timeoutInSec); wait.until(ExpectedConditions.alertIsPresent()); }
From source file:com.consol.citrus.selenium.actions.WaitUntilAction.java
License:Apache License
@Override protected void execute(WebElement webElement, SeleniumBrowser browser, TestContext context) { WebDriverWait q = new WebDriverWait(browser.getWebDriver(), Math.round(timeout / 1000)); if (condition.equals("hidden")) { q.until(ExpectedConditions.invisibilityOf(webElement)); } else if (condition.equals("visible")) { q.until(ExpectedConditions.visibilityOf(webElement)); } else {/*from w w w . j av a 2 s . c o m*/ throw new CitrusRuntimeException("Unknown wait condition"); } }
From source file:com.consol.citrus.selenium.client.WebClient.java
License:Apache License
/** * Wait until an item is loaded./* www . ja v a2 s. c om*/ * * @param by Element to wait for to be hidden. * @param sec Timeout * @return true when the element is invisible. */ public boolean waitUntilHidden(By by, long sec) { WebDriverWait q = new WebDriverWait(webDriver, sec); q.until(ExpectedConditions.invisibilityOfElementLocated(by)); return !findElement(by).isDisplayed(); }
From source file:com.contactenergy.Tests.ContactBrowserTest.java
@Test(dataProvider = "devices") public void ResidentialJoinJourney_onDesktop(TestDevice device) throws IOException, Exception { load("/Residential/Find-a-Plan"); Assert.assertTrue("Navigated to Residential Join Page", driver.get().findElement(By.xpath("//label[contains(.,'Enter your address')]")).isDisplayed()); 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(); 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 . ja va 2s . c om System.out.println(driver.get().findElement(By.cssSelector(".message")).getText()); scrollto("//h2[@class='recommendedplan-title']"); driver.get().findElement(By.xpath("//a[@data-filter='PPD']")).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 Join 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("//label[@for='Confirmation[ReceiveNewsAndOffers]']")).click(); 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("//label[@for='Property[MoveInfo][IsMovingHouse]_NO']")).click(); driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][WithAnotherSupplier]_YES']")) .click(); scrollto("//label[@for='Property[PropertyInfo][AddressSameAsPostalAddress]']"); driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][HasPropertyHazard]_NO']")).click(); 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(); scrollto("//h2[contains(.,'Final Steps')]"); driver.get().findElement(By.xpath("//label[@for='Customer[HasDriversLicense]_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 MoveNewCustomerJourney_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[1]/div/div/div[2]/div/a")).click(); 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(); 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();/*from ww w.j av a 2s.co 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 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("//label[@for='Confirmation[ReceiveNewsAndOffers]']")).click(); 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("//label[@for='Property[MoveInfo][IsMovingHouse]_YES']")).click(); driver.get().findElement(By.xpath("//input[@id='Property[MoveInfo][MoveInDate]']")).sendKeys("30/06/2017"); scrollto("//label[@for='Property[PropertyInfo][AddressSameAsPostalAddress]']"); driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][HasPropertyHazard]_NO']")).click(); scrollandclick("//label[@for='Property[MedicalInfo][HasVulnerablePerson]_NO']"); driver.get().findElement(By.xpath("//label[@for='Property[MedicalInfo][HasMedicalDependant]_NO']")).click(); driver.get().findElement(By.xpath("//label[@for='Promotion[PaperlessDiscount]_YES']")).click(); driver.get().findElement(By.xpath("//label[@for='Promotion[JoinDirectDebit]_NO']")).click(); driver.get().findElement(By.xpath("//label[@for='Customer[HasDriversLicense]_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 ExistingCustomerMovingHouseJourney_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[@for='UserJourneyAction_MoveHouse']")).click(); driver.get().findElement(By.xpath("//input[@id='AccountNumber']")).sendKeys("1231312232"); 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();/*from w ww .j av a2s .co m*/ scrollto("//h2[@class='recommendedplan-title']"); System.out.println(driver.get().findElement(By.cssSelector(".message")).getText()); 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 existing customer Move house 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"); driver.get().findElement(By.xpath("//label[contains(.,'Your current address')]")).click(); driver.get().findElement(By.xpath("//input[contains(@autocomplete,'off')]")) .sendKeys("2 Bressay Way, Waikanae 5036"); WebDriverWait wait1 = new WebDriverWait(driver.get(), 15); wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='ui-menu-item']"))); driver.get().findElement(By.xpath("//li[@class='ui-menu-item']")).click(); scrollto("//h2[contains(.,'About your property')]"); driver.get().findElement(By.xpath("//input[@id='Property[MoveInfo][MoveOutDate]']")).sendKeys("30/06/2017"); driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][HaveFinalMeterReading]_NO']")) .click(); driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][SendMeterReader]_NO']")).click(); driver.get().findElement(By.xpath("//input[@id='Property[MoveInfo][MoveInDate]']")).sendKeys("30/06/2017"); driver.get().findElement(By.xpath("//label[@for='Property[PropertyInfo][HasPropertyHazard]_NO']")).click(); driver.get().findElement(By.xpath("//label[@for='Property[MedicalInfo][HasVulnerablePerson]_NO']")).click(); driver.get().findElement(By.xpath("//label[@for='Property[MedicalInfo][HasMedicalDependant]_NO']")).click(); 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 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 w w w .java 2 s. c o m 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 ww .j a va 2 s . com*/ 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()); }