package jp.sourceforge.cfneo.at4ie2.api.browser.impl.ie;

import jp.sourceforge.cfneo.at4ie2.BTRuntimeError;
import jp.sourceforge.cfneo.at4ie2.api.browser.Anchor;
import watij.elements.Link;

public class BTAnchor implements Anchor {

	Link link;

	BTAnchor(Link link) {
		this.link = link;
	}

	@Override
	public void click() {
		try {
			this.link.click();
			Thread.sleep(1000L);
		} catch (Exception e) {
			throw new BTRuntimeError(e);
		}
	}
	@Override
	public String getHref() {
		try {
			return this.link.href();
		} catch (Exception e) {
			throw new BTRuntimeError(e);
		}
	}
	@Override
	public String getLable() {
		try {
			return this.link.text();
		} catch (Exception e) {
			throw new BTRuntimeError(e);
		}
	}
	@Override
	public boolean exists() {
		try {
			return this.link.exists();
		} catch (Exception e) {
			throw new BTRuntimeError(e);
		}
	}
	@Override
	public String getId() {
		try {
			return this.link.id();
		} catch (Exception e) {
			throw new BTRuntimeError(e);
		}
	}
	@Override
	public String getName() {
		try {
			return this.link.name();
		} catch (Exception e) {
			throw new BTRuntimeError(e);
		}
	}

}
