Skip to main content
Change selector on the code
Source Link
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;

@FindBy(xpath = "//div[@id='carouselExampleCaptions']//li"div[@class='carousel-inner']/div")
private List<WebElement> carouselElements;

(...)

 public void deltaTimeForCarouselElementSelect(){

    //site with carousel that automatically switch images
    driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");

    WebDriverWait driverWait = new WebDriverWait(driver, Duration.of(15, ChronoUnit.SECONDS));

    driverWait.until(ExpectedConditions.visibilityOf(carouselElementContainer));

    driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "active""carousel-item active"));

    double time1 = getMilliSecTime();
    System.out.printf("Time for first event: %s milliseconds %n", time1);

    driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
    double time2 = getMilliSecTime();

    System.out.printf("Time for last event: %s milliseconds %n", time2);

    double DeltaInMilli =  time2 - time1;

    System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}

private long getMilliSecTime(){
    Date date = new Date();

    return date.getTime();
}
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;

@FindBy(xpath = "//div[@id='carouselExampleCaptions']//li")
private List<WebElement> carouselElements;

(...)

 public void deltaTimeForCarouselElementSelect(){

    //site with carousel that automatically switch images
    driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");

    WebDriverWait driverWait = new WebDriverWait(driver, Duration.of(15, ChronoUnit.SECONDS));

    driverWait.until(ExpectedConditions.visibilityOf(carouselElementContainer));

    driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "active"));

    double time1 = getMilliSecTime();
    System.out.printf("Time for first event: %s milliseconds %n", time1);

    driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
    double time2 = getMilliSecTime();

    System.out.printf("Time for last event: %s milliseconds %n", time2);

    double DeltaInMilli =  time2 - time1;

    System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}

private long getMilliSecTime(){
    Date date = new Date();

    return date.getTime();
}
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;

@FindBy(xpath = "//div[@id='carouselExampleCaptions']//div[@class='carousel-inner']/div")
private List<WebElement> carouselElements;

(...)

 public void deltaTimeForCarouselElementSelect(){

    //site with carousel that automatically switch images
    driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");

    WebDriverWait driverWait = new WebDriverWait(driver, Duration.of(15, ChronoUnit.SECONDS));

    driverWait.until(ExpectedConditions.visibilityOf(carouselElementContainer));

    driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "carousel-item active"));

    double time1 = getMilliSecTime();
    System.out.printf("Time for first event: %s milliseconds %n", time1);

    driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
    double time2 = getMilliSecTime();

    System.out.printf("Time for last event: %s milliseconds %n", time2);

    double DeltaInMilli =  time2 - time1;

    System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}

private long getMilliSecTime(){
    Date date = new Date();

    return date.getTime();
}
added 70 characters in body
Source Link
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;

@FindBy(xpath = "//div[@id='carouselExampleCaptions']//li")
private List<WebElement> carouselElements;

(...)

 public void deltaTimeForCarouselElementSelect(){

    //site with carousel that automatically switch images
    driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");

    waitWebDriverWait driverWait = new WebDriverWait(driver, Duration.of(15, ChronoUnit.SECONDS));

    driverWait.until(ExpectedConditions.visibilityOf(carouselElementContainer));

    waitdriverWait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "active"));

    double initialTimetime1 = getCurrentMilliSecTimegetMilliSecTime();
    System.out.printf("Time for first event: %s milliseconds %n", initialTimetime1);

    waitdriverWait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
    double finalTimetime2 = getCurrentMilliSecTimegetMilliSecTime();

    System.out.printf("Time for last event: %s milliseconds %n", finalTimetime2);

    double DeltaInMilli =  finalTimetime2 - initialTime;time1;

    System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}

private long getCurrentMilliSecTimegetMilliSecTime(){
    Date date = new Date();

    return date.getTime();
}
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;

@FindBy(xpath = "//div[@id='carouselExampleCaptions']//li")
private List<WebElement> carouselElements;

(...)

public void deltaTimeForCarouselElementSelect(){

    //site with carousel that automatically switch images
    driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");

    wait.until(ExpectedConditions.visibilityOf(carouselElementContainer));

    wait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "active"));

    double initialTime = getCurrentMilliSecTime();
    System.out.printf("Time for first event: %s milliseconds %n", initialTime);

    wait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
    double finalTime = getCurrentMilliSecTime();

    System.out.printf("Time for last event: %s milliseconds %n", finalTime);

    double DeltaInMilli =  finalTime - initialTime;

    System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}

private long getCurrentMilliSecTime(){
    Date date = new Date();

    return date.getTime();
}
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;

@FindBy(xpath = "//div[@id='carouselExampleCaptions']//li")
private List<WebElement> carouselElements;

(...)

 public void deltaTimeForCarouselElementSelect(){

    //site with carousel that automatically switch images
    driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");

    WebDriverWait driverWait = new WebDriverWait(driver, Duration.of(15, ChronoUnit.SECONDS));

    driverWait.until(ExpectedConditions.visibilityOf(carouselElementContainer));

    driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "active"));

    double time1 = getMilliSecTime();
    System.out.printf("Time for first event: %s milliseconds %n", time1);

    driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
    double time2 = getMilliSecTime();

    System.out.printf("Time for last event: %s milliseconds %n", time2);

    double DeltaInMilli =  time2 - time1;

    System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}

private long getMilliSecTime(){
    Date date = new Date();

    return date.getTime();
}
added 2 characters in body
Source Link
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;

@FindBy(xpath = "//div[@id='carouselExampleCaptions']//li")
private List<WebElement> carouselElements;

(...)

public void deltaTimeForCarouselElementSelect(){

    //site with carousel that automatically switch images
    driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");

    wait.until(ExpectedConditions.visibilityOf(carouselElementContainer));

    wait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "active"));

    double initialTime = getCurrentMilliSecTime();
    System.out.printf("Time for first event: %s milliseconds %n", initialTime);

    wait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
    double finalTime = getCurrentMilliSecTime();

    System.out.printf("Time for last event: %s milliseconds %n", finalTime);

    longdouble DeltaInMilli =  finalTime - initialTime;

    System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}

private long getCurrentMilliSecTime(){
    Date date = new Date();

    return date.getTime();
}
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;

@FindBy(xpath = "//div[@id='carouselExampleCaptions']//li")
private List<WebElement> carouselElements;

(...)

public void deltaTimeForCarouselElementSelect(){

    //site with carousel that automatically switch images
    driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");

    wait.until(ExpectedConditions.visibilityOf(carouselElementContainer));

    wait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "active"));

    double initialTime = getCurrentMilliSecTime();
    System.out.printf("Time for first event: %s milliseconds %n", initialTime);

    wait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
    double finalTime = getCurrentMilliSecTime();

    System.out.printf("Time for last event: %s milliseconds %n", finalTime);

    long DeltaInMilli =  finalTime - initialTime;

    System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}

private long getCurrentMilliSecTime(){
    Date date = new Date();

    return date.getTime();
}
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;

@FindBy(xpath = "//div[@id='carouselExampleCaptions']//li")
private List<WebElement> carouselElements;

(...)

public void deltaTimeForCarouselElementSelect(){

    //site with carousel that automatically switch images
    driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");

    wait.until(ExpectedConditions.visibilityOf(carouselElementContainer));

    wait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "active"));

    double initialTime = getCurrentMilliSecTime();
    System.out.printf("Time for first event: %s milliseconds %n", initialTime);

    wait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
    double finalTime = getCurrentMilliSecTime();

    System.out.printf("Time for last event: %s milliseconds %n", finalTime);

    double DeltaInMilli =  finalTime - initialTime;

    System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}

private long getCurrentMilliSecTime(){
    Date date = new Date();

    return date.getTime();
}
added 102 characters in body
Source Link
Loading
added 155 characters in body
Source Link
Loading
Source Link
Loading