List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated
public static ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator)
From source file:com.pages.CompanyLoginpage.java
public static void Validate_CompanyLogin(WebDriver driver, String InValidCompanyNum) throws IOException { driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS); driver.manage().deleteAllCookies();//from w ww. ja va 2 s . c o m driver.manage().timeouts().implicitlyWait(1000, TimeUnit.SECONDS); JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("return document.readyState").equals("complete"); //Thread.sleep(1000); WebDriverWait ww = new WebDriverWait(driver, 30); ww.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(AccessKey_fld_xpath))); driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS); String CompanyNum = getValue("InValidCompanyNum"); if (CompanyNum.equals(InValidCompanyNum)) { driver.findElement(By.xpath(AccessKey_fld_xpath)).sendKeys(CompanyNum); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.findElement(By.xpath(Download_btn_xpath)).click(); String Error1 = driver.findElement(By.xpath(Error_Messagepart1_xpath)).getText(); String Error2 = driver.findElement(By.xpath(Error_Messagepart2_xpath)).getText(); String Error = Error1 + " " + Error2; if (Error.equalsIgnoreCase("ERROR! Invalid company.")) { System.out.println("Error message" + " " + Error + " " + "displayed, result as expected"); } else { AssertJUnit.fail("Error message not displayed"); } } }
From source file:com.pentaho.ctools.cde.reference.MapComponentReference.java
License:Apache License
/** * ############################### Test Case 2 ############################### * * Test Case Name:/* w ww. ja va 2s. c o m*/ * Map with no markers and no shapes * Description: * Validate contents in a simple map. * Steps: * 1. Check the data exist * 2. Perform a zoom * 3. Click in Globe */ @Test public void tc2_MapWithNoMarkersAndShapes_MapMustBeVisible() { this.log.info("tc2_MapWithNoMarkersAndShapes_MapMustBeVisible"); //wait for initialize wait.until(ExpectedConditions .invisibilityOfElementWithText(By.xpath("//div[@id='simpleTest']/div/div[8]/div"), "10000 km")); //## Step1 wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='subtitle0']/span"))); assertEquals("Map with no markers and no shapes - Simple Case", driver.findElement(By.xpath("//div[@id='subtitle0']/span")).getText()); //Scale wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='simpleTest']/div/div[8]/div"))); assertEquals("200 km", driver.findElement(By.xpath("//div[@id='simpleTest']/div/div[8]/div")).getText()); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='simpleTest']/div/div[8]/div[2]"))); assertEquals("200 mi", driver.findElement(By.xpath("//div[@id='simpleTest']/div/div[8]/div[2]")).getText()); //ButtonLayer assertNotNull(driver.findElement(By.xpath("//div[@id='simpleTest']/div/div[7]/div[2]/img"))); //Get same images assertNotNull(driver.findElement(By.xpath("//div[@id='simpleTest']/div/div/div/img"))); assertNotNull(driver.findElement(By.xpath("//div[@id='simpleTest']/div/div/div/img[12]"))); //## Step2 wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='simpleTest']/div/div[5]/div"))); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='simpleTest']/div/div[5]/div[2]"))); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='simpleTest']/div/div[5]/div[3]"))); driver.findElement(By.xpath("//div[@id='simpleTest']/div/div[5]/div")).click(); //wait for the field update wait.until(ExpectedConditions .invisibilityOfElementWithText(By.xpath("//div[@id='simpleTest']/div/div[8]/div"), "200 km")); wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='simpleTest']/div/div[8]/div"))); assertEquals("100 km", driver.findElement(By.xpath("//div[@id='simpleTest']/div/div[8]/div")).getText()); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='simpleTest']/div/div[8]/div[2]"))); assertEquals("100 mi", driver.findElement(By.xpath("//div[@id='simpleTest']/div/div[8]/div[2]")).getText()); //## Step3 driver.findElement(By.xpath("//div[@id='simpleTest']/div/div[5]/div[2]")).click(); //wait for the field update wait.until(ExpectedConditions .invisibilityOfElementWithText(By.xpath("//div[@id='simpleTest']/div/div[8]/div"), "100 km")); wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='simpleTest']/div/div[8]/div"))); assertEquals("10000 km", driver.findElement(By.xpath("//div[@id='simpleTest']/div/div[8]/div")).getText()); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='simpleTest']/div/div[8]/div[2]"))); assertEquals("5000 mi", driver.findElement(By.xpath("//div[@id='simpleTest']/div/div[8]/div[2]")).getText()); }
From source file:com.pentaho.ctools.cde.reference.MapComponentReference.java
License:Apache License
/** * ############################### Test Case 3 ############################### * * Test Case Name://w ww.jav a 2s . co m * Map engine and map tile services. * Description: * Validate the contents on the map and check if the map is display when * we change the map engine and tile services. * Steps: * 1. Check the data exist * 2. Chance map to Google * 3. Change map service to 'mapbox-world-dark' */ @Test public void tc3_MapEngineAndTileServices_MapDisplayedAfterChanges() { this.log.info("tc3_MapEngineAndTileServices_MapDisplayedAfterChanges"); //wait for initialize wait.until(ExpectedConditions.invisibilityOfElementWithText( By.xpath("//div[@id='testTileServices']/div/div[8]/div"), "10000 km")); //## Step1 wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='subtitle1']/span"))); assertEquals("Map engine and map tile services", driver.findElement(By.xpath("//div[@id='subtitle1']/span")).getText()); //mapEngine and service assertEquals("Select map engine:", driver.findElement(By.xpath("//div[@id='content']/div/div[6]/div/div/div")).getText()); assertEquals("Select tile map service:", driver.findElement(By.xpath("//div[@id='content']/div/div[6]/div/div[2]/div")).getText()); //Zoom wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='testTileServices']/div/div[5]/div"))); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='testTileServices']/div/div[5]/div[2]"))); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='testTileServices']/div/div[5]/div[3]"))); //Scale wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='testTileServices']/div/div[8]/div"))); assertEquals("200 km", driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[8]/div")).getText()); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='testTileServices']/div/div[8]/div[2]"))); assertEquals("200 mi", driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[8]/div[2]")).getText()); //Check if we are using OpenLayers final String mapId = driver.findElement(By.xpath("//div[@id='testTileServices']/div")).getAttribute("id"); assertTrue(mapId.contains("OpenLayers")); final Select mapEngine = new Select(driver.findElement(By.xpath("//div[@id='selectMapEngineObj']/select"))); final Select mapService = new Select(driver.findElement(By.xpath("//div[@id='selectTileObj']/select"))); assertEquals("openlayers", mapEngine.getFirstSelectedOption().getText()); assertEquals("mapquest-sat", mapService.getFirstSelectedOption().getText()); //## Step2 mapEngine.selectByValue("google"); this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='testTileServices']/div[@class='gm-style']"))); //Image with Google (left down corner) assertNotNull(driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[2]/a/div/img"))); //Text 'Termos de Utilizao (righ down corner) final String strMap = "Map"; final String strTerms = "Terms of Use"; final String strSat = "Satellite"; assertEquals(strTerms, driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[6]/div[2]/a")).getText()); //check if we have mapquest-sat/Mapa/Satelite assertEquals("mapquest-sat", driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[9]/div/div")).getText()); assertEquals(strMap, driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[9]/div[2]/div")).getText()); assertEquals(strSat, driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[9]/div[3]/div")).getText()); //## Step3 mapService.selectByValue("mapbox-world-dark"); this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); wait.until(ExpectedConditions.invisibilityOfElementWithText( By.xpath("//div[@id='testTileServices']/div/div[9]/div/div"), "mapquest-sat")); //Image with Google (left down corner) assertNotNull(driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[2]/a/div/img"))); //Text 'Termos de Utilizao (righ down corner) assertEquals(strTerms, driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[6]/div[2]/a")).getText()); //check if we have mapbox-world-dark/Mapa/Satelite assertEquals("mapbox-world-dark", driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[9]/div/div")).getText()); assertEquals(strMap, driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[9]/div[2]/div")).getText()); assertEquals(strSat, driver.findElement(By.xpath("//div[@id='testTileServices']/div/div[9]/div[3]/div")).getText()); }
From source file:com.pentaho.ctools.cdf.AnalyzerComponent.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name:/*from ww w . j a va2 s . c o m*/ * Display Content * Description: * Check if the contents present in page is the expected. * Steps: * 1. Check title web page and sample title. */ @Test public void tc1_PageContent_DisplayTitle() { this.log.info("tc1_PageContent_DisplayTitle"); // Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); // Wait for visibility of 'VisualizationAPIComponent' wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("AnalyzerComponent", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); }
From source file:com.pentaho.ctools.cdf.CommentComponent.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name://w ww .j a v a 2 s . co m * Reload Sample * Description: * Reload the sample (not refresh page). * Steps: * 1. Click in Code and then click in button 'Try me'. */ @Test public void tc1_PageContent_DisplayTitle() { this.log.info("tc1_PageContent_DisplayTitle"); // Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); // Wait for visibility of 'VisualizationAPIComponent' wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("CommentsComponent", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); }
From source file:com.pentaho.ctools.cdf.DateRangeInputComponent.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name:// w w w . j av a 2s . c o m * Validate Page Contents * Description: * Here we want to validate the page contents. * Steps: * 1. Check the widget's title. */ @Test public void tc1_PageContent_DisplayTitle() { // Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); // Wait for visibility of 'VisualizationAPIComponent' wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("DateRangeInputComponent", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); }
From source file:com.pentaho.ctools.cdf.DialComponent.java
License:Apache License
/** * ############################### Test Case 2 ############################### * * Test Case Name:// w w w . j a v a2 s .co m * Reload Sample * Description: * Reload the sample (not refresh page). * Steps: * 1. Click in Code and then click in button 'Try me'. */ @Test public void tc1_PageContent_DisplayTitle() { this.log.info("tc1_PageContent_DisplayTitle"); // Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); // Wait for visibility of 'VisualizationAPIComponent' wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("DialComponent", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); }
From source file:com.pentaho.ctools.cdf.ExecuteAnalyzerComponent.java
License:Apache License
/** * ############################### Test Case 2 ############################### * * Test Case Name:/*from w w w. j a v a 2 s . co m*/ * Reload Sample * Description: * Reload the sample (not refresh page). * Steps: * 1. Click in Code and then click in button 'Try me'. */ @Test public void tc1_PageContent_DisplayTitle() { this.log.info("tc1_PageContent_DisplayTitle"); // Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); // Wait for visibility of 'VisualizationAPIComponent' wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("ExecuteAnalyzerComponent", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); }
From source file:com.pentaho.ctools.cdf.ExecutePrptComponent.java
License:Apache License
/** * ############################### Test Case 2 ############################### * * Test Case Name://from w w w. ja v a 2s. co m * Reload Sample * Description: * Reload the sample (not refresh page). * Steps: * 1. Click in Code and then click in button 'Try me'. */ @Test public void tc1_PageContent_DisplayTitle() { this.log.info("tc1_PageContent_DisplayTitle"); // Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); // Wait for visibility of 'VisualizationAPIComponent' wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("ExecutePrptComponent", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); }
From source file:com.pentaho.ctools.cdf.ExecuteXactionComponent.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name://from w w w . jav a2 s . com * Reload Sample * Description: * Reload the sample (not refresh page). * Steps: * 1. Click in Code and then click in button 'Try me'. */ @Test public void tc1_PageContent_DisplayTitle() { // Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); // Wait for visibility of 'VisualizationAPIComponent' wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("ExecuteXactionComponent", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); }