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

daveayan.gherkinsalad.components.html.CheckBox Maven / Gradle / Ivy

There is a newer version: 2.5
Show newest version
package daveayan.gherkinsalad.components.html;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.TimeoutException;

import daveayan.gherkinsalad.components.Clickable;
import daveayan.gherkinsalad.components.Element;

public class CheckBox extends BaseBrowserElement implements Clickable {
	private static Log log = LogFactory.getLog(CheckBox.class);
	
	public CheckBox name(String name) {
		super.name(name);
		return this;
	}

	public void click_if_enabled() {
		Element element = root_element();
		if(this.isEnabled()) {
			element.click();
		}
	}
	
	public void click_if_exists() {
		click_if_enabled();
	}
	
	public void click_if_exists_and_enabled() {
		try {
			click_if_enabled();
			log.info("Clicked on " + this);
		} catch(TimeoutException te) {
			log.info("Element does not exist " + this);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy