All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gfk.senbot.framework.cucumber.stepdefinitions.ExpectedWebElementCondition Maven / Gradle / Ivy

Go to download

The SenBot runner which will actually run all your acceptance tests and report the outcome

There is a newer version: 0.4.8
Show newest version
package com.gfk.senbot.framework.cucumber.stepdefinitions;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.gfk.senbot.framework.context.SenBotContext;

public class ExpectedWebElementCondition implements ExpectedGlobalCondition {
	
	private static final Logger log = LoggerFactory.getLogger(ExpectedWebElementCondition.class);
	
	private final By locator;

	/**
	 * @param locator
	 */
	public ExpectedWebElementCondition(By locator) {
		this.locator = locator;
	}

	@Override
	public void checkExpected(WebDriver webDriver) {
		log.debug("Check for invisibility of " + locator);		
		ExpectedCondition invisibilityOfElementLocated = ExpectedConditions.invisibilityOfElementLocated(locator);
		new WebDriverWait(webDriver, SenBotContext.getSenBotContext().getSeleniumManager().getTimeout()).until(invisibilityOfElementLocated);
		log.debug("Invisibility of " + locator + " detected");
	}

	public By getLocator() {
		return locator;
	}
	
	@Override
	public String toString() {
		return "Wait for invisibilty of:" + locator;
	}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy