package com.thoughtworks.selenium.corebased;
import com.thoughtworks.selenium.*;
/**
 * @author XlateHtmlSeleneseToJava
 * Generated from E:\buildroot\Dev\selenium-rc_svn\trunk\rc\clients\java\target\selenium-server\tests/TestLocators.html.
 */
public class TestLocators extends SeleneseTestCase
{
   public void testLocators() throws Throwable {
		selenium.setContext("Test Locators", "info");

/* Test Locators */
		// open|../tests/html/test_locators.html|
		selenium.open("../tests/html/test_locators.html");

		/* Id location */
		// verifyText|id=id1|this is the first element
		verifyEquals("this is the first element", selenium.getText("id=id1"));

		boolean sawThrow7 = false;
		try {
			// originally verifyElementNotPresent|id=name1|
				assertTrue(!selenium.isElementPresent("id=name1"));
		}
		catch (Throwable e) {
			sawThrow7 = true;
		}
		verifyFalse(sawThrow7);
		

		boolean sawThrow8 = false;
		try {
			// originally verifyElementNotPresent|id=id4|
				assertTrue(!selenium.isElementPresent("id=id4"));
		}
		catch (Throwable e) {
			sawThrow8 = true;
		}
		verifyFalse(sawThrow8);
		
		// verifyAttribute|id=id1@class|a1
		verifyEquals("a1", selenium.getAttribute("id=id1@class"));

		/* name location */
		// verifyText|name=name1|this is the second element
		verifyEquals("this is the second element", selenium.getText("name=name1"));

		boolean sawThrow13 = false;
		try {
			// originally verifyElementNotPresent|name=id1|
				assertTrue(!selenium.isElementPresent("name=id1"));
		}
		catch (Throwable e) {
			sawThrow13 = true;
		}
		verifyFalse(sawThrow13);
		

		boolean sawThrow14 = false;
		try {
			// originally verifyElementNotPresent|name=notAName|
				assertTrue(!selenium.isElementPresent("name=notAName"));
		}
		catch (Throwable e) {
			sawThrow14 = true;
		}
		verifyFalse(sawThrow14);
		
		// verifyAttribute|name=name1@class|a2
		verifyEquals("a2", selenium.getAttribute("name=name1@class"));

		/* class location */
		// verifyText|class=a3|this is the third element
		verifyEquals("this is the third element", selenium.getText("class=a3"));

		/* alt location */

		boolean sawThrow21 = false;
		try {
			// originally verifyElementPresent|alt=banner|
				assertTrue(selenium.isElementPresent("alt=banner"));
		}
		catch (Throwable e) {
			sawThrow21 = true;
		}
		verifyFalse(sawThrow21);
		

		/* identifier location */
		// verifyText|identifier=id1|this is the first element
		verifyEquals("this is the first element", selenium.getText("identifier=id1"));

		boolean sawThrow25 = false;
		try {
			// originally verifyElementNotPresent|identifier=id4|
				assertTrue(!selenium.isElementPresent("identifier=id4"));
		}
		catch (Throwable e) {
			sawThrow25 = true;
		}
		verifyFalse(sawThrow25);
		
		// verifyAttribute|identifier=id1@class|a1
		verifyEquals("a1", selenium.getAttribute("identifier=id1@class"));
		// verifyText|identifier=name1|this is the second element
		verifyEquals("this is the second element", selenium.getText("identifier=name1"));
		// verifyAttribute|identifier=name1@class|a2
		verifyEquals("a2", selenium.getAttribute("identifier=name1@class"));

		/* DOM Traversal location */
		// verifyText|dom=document.links[1]|this is the second element
		verifyEquals("this is the second element", selenium.getText("dom=document.links[1]"));
		// verifyAttribute|dom=document.links[1]@class|a2
		verifyEquals("a2", selenium.getAttribute("dom=document.links[1]@class"));

		boolean sawThrow33 = false;
		try {
			// originally verifyElementNotPresent|dom=document.links[9]|
				assertTrue(!selenium.isElementPresent("dom=document.links[9]"));
		}
		catch (Throwable e) {
			sawThrow33 = true;
		}
		verifyFalse(sawThrow33);
		

		boolean sawThrow34 = false;
		try {
			// originally verifyElementNotPresent|dom=foo|
				assertTrue(!selenium.isElementPresent("dom=foo"));
		}
		catch (Throwable e) {
			sawThrow34 = true;
		}
		verifyFalse(sawThrow34);
		

		/* Link location */

		boolean sawThrow37 = false;
		try {
			// originally verifyElementPresent|link=this is the second element|a2
				assertTrue(selenium.isElementPresent("link=this is the second element"));
		}
		catch (Throwable e) {
			sawThrow37 = true;
		}
		verifyFalse(sawThrow37);
		
		assertTrue(selenium.isTextPresent("this is the second element"));

		boolean sawThrow39 = false;
		try {
			// originally verifyElementPresent|link=this * second element|a2
				assertTrue(selenium.isElementPresent("link=this * second element"));
		}
		catch (Throwable e) {
			sawThrow39 = true;
		}
		verifyFalse(sawThrow39);
		

		boolean sawThrow40 = false;
		try {
			// originally verifyElementPresent|link=regexp:this [aeiou]s the second element|a2
				assertTrue(selenium.isElementPresent("link=regexp:this [aeiou]s the second element"));
		}
		catch (Throwable e) {
			sawThrow40 = true;
		}
		verifyFalse(sawThrow40);
		
		// verifyAttribute|link=this is the second element@class|a2
		verifyEquals("a2", selenium.getAttribute("link=this is the second element@class"));

		boolean sawThrow42 = false;
		try {
			// originally verifyElementNotPresent|link=this is not an element|
				assertTrue(!selenium.isElementPresent("link=this is not an element"));
		}
		catch (Throwable e) {
			sawThrow42 = true;
		}
		verifyFalse(sawThrow42);
		

		checkForVerificationErrors();
	}
}
