List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated
public static ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator)
From source file:com.codenvy.corp.MainPage.java
License:Open Source License
private void initId() { String idAttrIDE = new WebDriverWait(driver, 10) .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.rapidIdForIDE))) .getAttribute("id"); String idAttrPLF = new WebDriverWait(driver, 10) .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.rapidIdForPLF))) .getAttribute("id"); agileIdIDE = Integer.parseInt(idAttrIDE.replace("rapidb_lnk_", "").replace("_lnk", "")); agileIdPLF = Integer.parseInt(idAttrPLF.replace("rapidb_lnk_", "").replace("_lnk", "")); }
From source file:com.coderoad.automation.common.util.PageUtil.java
License:Open Source License
/** * Checks if is displayed.//from w w w . j a v a2 s .co m * * @param driver the driver * @param locator the locator * @param timeout the timeout * @return true, if is displayed */ public static boolean isDisplayed(final WebDriver driver, final By locator, final Timeout timeout) { try { return new WebDriverWait(driver, timeout.getValue()) .until(ExpectedConditions.visibilityOfElementLocated(locator)).isDisplayed(); } catch (Exception ex) { return false; } }
From source file:com.cognifide.aet.job.common.modifiers.login.LoginFormComponent.java
License:Apache License
private WebElement getElementByXpath(WebDriver webDriver, String xpathExpression) { WebDriverWait wait = new WebDriverWait(webDriver, TIMEOUT); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpathExpression))); return webDriver.findElement(By.xpath(xpathExpression)); }
From source file:com.cognifide.bdd.demo.po.login.LoginPage.java
License:Apache License
public LoginPage openLoginPage() { webDriver.get(authorUrl);/* w w w .j av a2s. c o m*/ wait.withTimeout(Timeouts.MEDIUM).until(ExpectedConditions.visibilityOfElementLocated(By.id("login-box"))); return this; }
From source file:com.cognifide.qa.bb.aem.core.component.dialog.dialogfields.PathBrowser.java
License:Apache License
/** * Sets path in path browser./*from www .j a v a 2 s.c o m*/ * * @param value string path value. */ @Override public void setValue(Object value) { if (contains(currentScope.getAttribute(HtmlTags.Attributes.CLASS), TEXT_FIELD_CLASS)) { currentScope.clear(); currentScope.sendKeys(String.valueOf(value)); } else { input.clear(); input.sendKeys(String.valueOf(value)); } bobcatWait.until(ExpectedConditions.visibilityOfElementLocated( By.cssSelector(".foundation-picker-buttonlist.coral3-Overlay.is-open"))); currentScope.findElement(By.className("coral-Form-fieldlabel")).click(); }
From source file:com.cognifide.qa.bb.aem.dialog.classic.field.image.AemImage.java
License:Apache License
/** * Clicks the "Clear" button and waits until the image is replaced by default/blank image and * message.// www.j a v a 2 s . c om * * @return This instance. */ public AemImage clear() { waitForToolbarEnabled(); clearButton.click(); bobcatWait.withTimeout(Timeouts.MEDIUM) .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(DROP_AN_IMAGE_XPATH))); return this; }
From source file:com.cognifide.qa.bb.aem.ui.AemDialog.java
License:Apache License
private List<WebElement> getAllTabs() { bobcatWait.withTimeout(Timeouts.BIG) .until(ExpectedConditions.visibilityOfElementLocated(DIALOG_XPATH_COMPILED)); WebElement dialog = webDriver.findElement(DIALOG_XPATH_COMPILED); return dialog.findElements( By.cssSelector("div.x-tab-panel-header span.x-tab-strip-inner span.x-tab-strip-text")); }
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();/* ww w . j ava 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='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();/* ww w . j a v a 2 s . 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='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();// w w w .j ava2 s .com 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()); }