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

info.kapable.sondes.scenarios.action.IfAction Maven / Gradle / Ivy

package info.kapable.sondes.scenarios.action;

import java.util.List;

import org.openqa.selenium.WebDriver;

import info.kapable.sondes.scenarios.ScenarioException;

public class IfAction extends Action {
	private List thenAction;
	private List elseAction;
	private String textAttendu;
	
	public IfAction(String textAttendu, List thenAction, List elseAction) {
		this.elseAction = elseAction;
		this.thenAction = thenAction;
		this.textAttendu = textAttendu;
	}
	
	@Override
	public void executeAction(WebDriver driver) throws ScenarioException {
		this.logEvent("Firefox", "Verification Texte pr�sent :  " + this.textAttendu);
		if(driver.getPageSource().contains(this.textAttendu))
	    {
			this.logEvent("Firefox", "Trouv?");
			for (Action action : this.thenAction) {
				action.executeAction(driver);
			}
	    } else {
			this.logEvent("Firefox", "Non trouv?");
			for (Action action : this.elseAction) {
				action.executeAction(driver);
			}
	    }
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy