예제 #1
0
  private void clickFirstBlog() {
    driver.findElement(By.xpath("//*[@id='homepageFeed']/div[3]/div[3]/div[1]/a[2]")).click();
    WaitUtility.sleep(1500);
    List<WebElement> feedItems =
        driver.findElement(By.id("feedItems")).findElements(By.tagName("a"));

    for (WebElement item : feedItems) {
      item.click();
      break;
    }
  }
예제 #2
0
  public void AL_534_eyesToEars() {
    clickFirstArticle();

    int count = 0;
    // Make sure that there is only one widget
    List<WebElement> divs = driver.findElements(By.className("e2eWidget"));
    for (WebElement div : divs) {
      if (div.getAttribute("style").contains("visibility: visible;")) count++;
    }

    if (count > 1)
      errors.append("There is more than 1 eye to ear widgets displayed in this article: " + count);
    // Make sure no overlapping
    String display = driver.findElement(By.className("e2eWidget")).getAttribute("style");
    if (!display.contains("display: block"))
      errors.append("Eye to Ear is not displayed correctly.");
    // String e2eStationName = driver.findElement(By.cssSelector("body > div.pageWrapper >
    // div.pageContainer.subpageContent.subpage-details > div.leftContainer > div.detailContent >
    // div:nth-child(8) > figure.position1 > figcaption > div > h5 > a")).getText();
    String e2eStationName =
        driver
            .findElements(By.tagName("figCaption"))
            .get(0)
            .findElement(By.tagName("h5"))
            .findElement(By.tagName("a"))
            .getText();
    System.out.println("e2eStationName:" + e2eStationName);
    // e2ePlayerButton.click();
    // driver.findElements(By.tagName("figure")).get(0).findElement(By.className("position1")).click();
    driver
        .findElements(By.tagName("figCaption"))
        .get(0)
        .findElement(By.tagName("h5"))
        .findElement(By.tagName("a"))
        .click();
    String windowPrevious = switchWindow();
    // String stationName = driver.findElement(By.cssSelector("#hero > div.hero-content > div >
    // div.profile-info > div > ul > li.station-name > span")).getText();

    String stationName = "";
    try {
      stationName = driver.findElement(By.className("station-name")).getText();
    } catch (Exception e) {
      WaitUtility.sleep(1000);
      stationName = driver.findElement(By.className("station-name")).getText();
    }

    System.out.println("stationName:" + stationName);
    if (!e2eStationName.equalsIgnoreCase(stationName))
      errors.append("Wrong radio station is launched from eye to ear.");
  }