Example usage for org.openqa.selenium By linkText

List of usage examples for org.openqa.selenium By linkText

Introduction

In this page you can find the example usage for org.openqa.selenium By linkText.

Prototype

public static By linkText(String linkText) 

Source Link

Usage

From source file:com.consol.citrus.dsl.design.SeleniumTestDesignerTest.java

License:Apache License

@Test
public void testSeleniumBuilder() {
    MockTestDesigner builder = new MockTestDesigner(applicationContext, context) {
        @Override/* w  w w . j  a  v  a  2  s.co m*/
        public void configure() {
            selenium().start(seleniumBrowser);

            selenium().navigate("http://localhost:9090");

            selenium().find().element(By.id("target"));
            selenium().find().element("class-name", "${cssClass}").tagName("button").enabled(false)
                    .displayed(false).text("Click Me!").style("color", "red").attribute("type", "submit");

            selenium().click().element(By.linkText("Click Me!"));
            selenium().hover().element(By.linkText("Hover Me!"));

            selenium().setInput("Citrus").element(By.name("username"));
            selenium().checkInput(false).element(By.xpath("//input[@type='checkbox']"));

            selenium().javascript("alert('Hello!')").errors("This went wrong!");

            selenium().alert().text("Hello!").accept();

            selenium().clearCache();

            selenium().store("classpath:download/file.txt");
            selenium().getStored("file.txt");

            selenium().open().window("my_window");
            selenium().focus().window("my_window");
            selenium().close().window("my_window");

            selenium().waitUntil().hidden().element(By.name("hiddenButton"));

            selenium().stop();
        }
    };

    builder.configure();

    TestCase test = builder.getTestCase();
    int actionIndex = 0;
    Assert.assertEquals(test.getActionCount(), 18);

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            StartBrowserAction.class);
    StartBrowserAction startBrowserAction = (StartBrowserAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(startBrowserAction.getName(), "selenium:start");
    Assert.assertNotNull(startBrowserAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            NavigateAction.class);
    NavigateAction navigateAction = (NavigateAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(navigateAction.getName(), "selenium:navigate");
    Assert.assertEquals(navigateAction.getPage(), "http://localhost:9090");
    Assert.assertNull(navigateAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            FindElementAction.class);
    FindElementAction findElementAction = (FindElementAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(findElementAction.getName(), "selenium:find");
    Assert.assertEquals(findElementAction.getBy(), By.id("target"));
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            FindElementAction.class);
    findElementAction = (FindElementAction) ((DelegatingTestAction) test.getActions().get(actionIndex++))
            .getDelegate();
    Assert.assertEquals(findElementAction.getName(), "selenium:find");
    Assert.assertEquals(findElementAction.getProperty(), "class-name");
    Assert.assertEquals(findElementAction.getPropertyValue(), "${cssClass}");
    Assert.assertEquals(findElementAction.getTagName(), "button");
    Assert.assertEquals(findElementAction.getText(), "Click Me!");
    Assert.assertFalse(findElementAction.isEnabled());
    Assert.assertFalse(findElementAction.isDisplayed());
    Assert.assertEquals(findElementAction.getStyles().size(), 1L);
    Assert.assertEquals(findElementAction.getStyles().get("color"), "red");
    Assert.assertEquals(findElementAction.getAttributes().size(), 1L);
    Assert.assertEquals(findElementAction.getAttributes().get("type"), "submit");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            ClickAction.class);
    ClickAction clickAction = (ClickAction) ((DelegatingTestAction) test.getActions().get(actionIndex++))
            .getDelegate();
    Assert.assertEquals(clickAction.getName(), "selenium:click");
    Assert.assertEquals(clickAction.getBy(), By.linkText("Click Me!"));
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            HoverAction.class);
    HoverAction hoverAction = (HoverAction) ((DelegatingTestAction) test.getActions().get(actionIndex++))
            .getDelegate();
    Assert.assertEquals(hoverAction.getName(), "selenium:hover");
    Assert.assertEquals(hoverAction.getBy(), By.linkText("Hover Me!"));
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            SetInputAction.class);
    SetInputAction setInputAction = (SetInputAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(setInputAction.getName(), "selenium:set-input");
    Assert.assertEquals(setInputAction.getBy(), By.name("username"));
    Assert.assertEquals(setInputAction.getValue(), "Citrus");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            CheckInputAction.class);
    CheckInputAction checkInputAction = (CheckInputAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(checkInputAction.getName(), "selenium:check-input");
    Assert.assertEquals(checkInputAction.getBy(), By.xpath("//input[@type='checkbox']"));
    Assert.assertFalse(checkInputAction.isChecked());
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            JavaScriptAction.class);
    JavaScriptAction javaScriptAction = (JavaScriptAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(javaScriptAction.getName(), "selenium:javascript");
    Assert.assertEquals(javaScriptAction.getScript(), "alert('Hello!')");
    Assert.assertEquals(javaScriptAction.getExpectedErrors().size(), 1L);
    Assert.assertEquals(javaScriptAction.getExpectedErrors().get(0), "This went wrong!");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            AlertAction.class);
    AlertAction alertAction = (AlertAction) ((DelegatingTestAction) test.getActions().get(actionIndex++))
            .getDelegate();
    Assert.assertEquals(alertAction.getName(), "selenium:alert");
    Assert.assertEquals(alertAction.getText(), "Hello!");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            ClearBrowserCacheAction.class);
    ClearBrowserCacheAction clearBrowserCacheAction = (ClearBrowserCacheAction) ((DelegatingTestAction) test
            .getActions().get(actionIndex++)).getDelegate();
    Assert.assertEquals(clearBrowserCacheAction.getName(), "selenium:clear-cache");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            StoreFileAction.class);
    StoreFileAction storeFileAction = (StoreFileAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(storeFileAction.getName(), "selenium:store-file");
    Assert.assertEquals(storeFileAction.getFilePath(), "classpath:download/file.txt");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            GetStoredFileAction.class);
    GetStoredFileAction getStoredFileAction = (GetStoredFileAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(getStoredFileAction.getName(), "selenium:get-stored-file");
    Assert.assertEquals(getStoredFileAction.getFileName(), "file.txt");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            OpenWindowAction.class);
    OpenWindowAction openWindowAction = (OpenWindowAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(openWindowAction.getName(), "selenium:open-window");
    Assert.assertEquals(openWindowAction.getWindowName(), "my_window");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            SwitchWindowAction.class);
    SwitchWindowAction switchWindowAction = (SwitchWindowAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(switchWindowAction.getName(), "selenium:switch-window");
    Assert.assertEquals(switchWindowAction.getWindowName(), "my_window");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            CloseWindowAction.class);
    CloseWindowAction closeWindowAction = (CloseWindowAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(closeWindowAction.getName(), "selenium:close-window");
    Assert.assertEquals(closeWindowAction.getWindowName(), "my_window");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            WaitUntilAction.class);
    WaitUntilAction waitUntilAction = (WaitUntilAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(waitUntilAction.getName(), "selenium:wait");
    Assert.assertEquals(waitUntilAction.getBy(), By.name("hiddenButton"));
    Assert.assertEquals(waitUntilAction.getCondition(), "hidden");
    Assert.assertNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            StopBrowserAction.class);
    StopBrowserAction stopBrowserAction = (StopBrowserAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(stopBrowserAction.getName(), "selenium:stop");
    Assert.assertNull(stopBrowserAction.getBrowser());
}

From source file:com.consol.citrus.dsl.runner.SeleniumTestRunnerTest.java

License:Apache License

@Test
public void testSeleniumBuilder() {
    when(applicationContextMock.getBean(TestContext.class))
            .thenReturn(applicationContext.getBean(TestContext.class));
    when(applicationContextMock.getBean(TestActionListeners.class)).thenReturn(new TestActionListeners());
    when(applicationContextMock.getBeansOfType(SequenceBeforeTest.class))
            .thenReturn(new HashMap<String, SequenceBeforeTest>());
    when(applicationContextMock.getBeansOfType(SequenceAfterTest.class))
            .thenReturn(new HashMap<String, SequenceAfterTest>());

    when(seleniumBrowser.getEndpointConfiguration()).thenReturn(seleniumBrowserConfiguration);
    when(seleniumBrowserConfiguration.getBrowserType()).thenReturn(BrowserType.CHROME);
    when(seleniumBrowser.getWebDriver()).thenReturn(webDriver);

    when(seleniumBrowser.getName()).thenReturn("mockBrowser");
    when(applicationContextMock.getBean("mockBrowser", SeleniumBrowser.class)).thenReturn(seleniumBrowser);

    when(webDriver.navigate()).thenReturn(navigation);
    when(webDriver.manage()).thenReturn(options);
    when(webDriver.switchTo()).thenReturn(locator);
    when(locator.alert()).thenReturn(alert);
    when(alert.getText()).thenReturn("Hello!");

    when(webDriver.findElement(By.id("header"))).thenReturn(element);
    when(element.getTagName()).thenReturn("h1");
    when(element.isEnabled()).thenReturn(true);
    when(element.isDisplayed()).thenReturn(true);

    when(webDriver.findElement(By.linkText("Click Me!"))).thenReturn(link);
    when(link.getTagName()).thenReturn("a");
    when(link.isEnabled()).thenReturn(true);
    when(link.isDisplayed()).thenReturn(true);

    when(webDriver.findElement(By.linkText("Hover Me!"))).thenReturn(link);
    when(webDriver.getMouse()).thenReturn(mouse);
    when(webDriver.getKeyboard()).thenReturn(keyboard);

    when(link.getCoordinates()).thenReturn(coordinates);

    when(webDriver.findElement(By.name("username"))).thenReturn(input);
    when(input.getTagName()).thenReturn("input");
    when(input.isEnabled()).thenReturn(true);
    when(input.isDisplayed()).thenReturn(true);

    when(webDriver.findElement(By.name("hiddenButton"))).thenReturn(hidden);
    when(hidden.getTagName()).thenReturn("input");
    when(hidden.isEnabled()).thenReturn(true);
    when(hidden.isDisplayed()).thenReturn(false);

    when(webDriver.findElement(By.xpath("//input[@type='checkbox']"))).thenReturn(checkbox);
    when(checkbox.getTagName()).thenReturn("input");
    when(checkbox.isEnabled()).thenReturn(true);
    when(checkbox.isDisplayed()).thenReturn(true);
    when(checkbox.isSelected()).thenReturn(false);

    when(webDriver.executeScript(anyString())).thenReturn(Collections.singletonList("This went wrong!"));

    when(webDriver.findElement(By.className("btn"))).thenReturn(button);
    when(button.getTagName()).thenReturn("button");
    when(button.isEnabled()).thenReturn(false);
    when(button.isDisplayed()).thenReturn(false);
    when(button.getText()).thenReturn("Click Me!");
    when(button.getAttribute("type")).thenReturn("submit");
    when(button.getCssValue("color")).thenReturn("red");

    when(seleniumBrowser.getStoredFile("file.txt")).thenReturn("file.txt");
    Set<String> windows = new HashSet<>();
    windows.add("last_window");
    windows.add("new_window");
    when(webDriver.getWindowHandles()).thenReturn(Collections.singleton("last_window")).thenReturn(windows);
    when(webDriver.getWindowHandle()).thenReturn("last_window");

    context.setApplicationContext(applicationContextMock);
    context.setVariable("cssClass", "btn");

    MockTestRunner builder = new MockTestRunner(getClass().getSimpleName(), applicationContextMock, context) {
        @Override/*from  www.j a  va  2 s .  c om*/
        public void execute() {
            selenium(action -> action.start(seleniumBrowser));

            selenium(action -> action.navigate("http://localhost:9090"));

            selenium(action -> action.find().element(By.id("header")));
            selenium(action -> action.find().element("class-name", "${cssClass}").tagName("button")
                    .enabled(false).displayed(false).text("Click Me!").style("color", "red")
                    .attribute("type", "submit"));

            selenium(action -> action.click().element(By.linkText("Click Me!")));
            selenium(action -> action.hover().element(By.linkText("Hover Me!")));

            selenium(action -> action.setInput("Citrus").element(By.name("username")));
            selenium(action -> action.checkInput(false).element(By.xpath("//input[@type='checkbox']")));

            selenium(action -> action.javascript("alert('Hello!')").errors("This went wrong!"));

            selenium(action -> action.alert().text("Hello!").accept());

            selenium(action -> action.clearCache());

            selenium(action -> action.store("classpath:download/file.txt"));
            selenium(action -> action.getStored("file.txt"));

            selenium(action -> action.open().window("my_window"));
            selenium(action -> action.focus().window("my_window"));
            selenium(action -> action.close().window("my_window"));

            selenium(action -> action.waitUntil().hidden().element(By.name("hiddenButton")));

            selenium(action -> action.stop());
        }
    };

    TestCase test = builder.getTestCase();
    int actionIndex = 0;
    Assert.assertEquals(test.getActionCount(), 18);

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            StartBrowserAction.class);
    StartBrowserAction startBrowserAction = (StartBrowserAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(startBrowserAction.getName(), "selenium:start");
    Assert.assertNotNull(startBrowserAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            NavigateAction.class);
    NavigateAction navigateAction = (NavigateAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(navigateAction.getName(), "selenium:navigate");
    Assert.assertEquals(navigateAction.getPage(), "http://localhost:9090");
    Assert.assertNotNull(navigateAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            FindElementAction.class);
    FindElementAction findElementAction = (FindElementAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(findElementAction.getName(), "selenium:find");
    Assert.assertEquals(findElementAction.getBy(), By.id("header"));
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            FindElementAction.class);
    findElementAction = (FindElementAction) ((DelegatingTestAction) test.getActions().get(actionIndex++))
            .getDelegate();
    Assert.assertEquals(findElementAction.getName(), "selenium:find");
    Assert.assertEquals(findElementAction.getProperty(), "class-name");
    Assert.assertEquals(findElementAction.getPropertyValue(), "${cssClass}");
    Assert.assertEquals(findElementAction.getTagName(), "button");
    Assert.assertEquals(findElementAction.getText(), "Click Me!");
    Assert.assertFalse(findElementAction.isEnabled());
    Assert.assertFalse(findElementAction.isDisplayed());
    Assert.assertEquals(findElementAction.getStyles().size(), 1L);
    Assert.assertEquals(findElementAction.getStyles().get("color"), "red");
    Assert.assertEquals(findElementAction.getAttributes().size(), 1L);
    Assert.assertEquals(findElementAction.getAttributes().get("type"), "submit");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            ClickAction.class);
    ClickAction clickAction = (ClickAction) ((DelegatingTestAction) test.getActions().get(actionIndex++))
            .getDelegate();
    Assert.assertEquals(clickAction.getName(), "selenium:click");
    Assert.assertEquals(clickAction.getBy(), By.linkText("Click Me!"));
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            HoverAction.class);
    HoverAction hoverAction = (HoverAction) ((DelegatingTestAction) test.getActions().get(actionIndex++))
            .getDelegate();
    Assert.assertEquals(hoverAction.getName(), "selenium:hover");
    Assert.assertEquals(hoverAction.getBy(), By.linkText("Hover Me!"));
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            SetInputAction.class);
    SetInputAction setInputAction = (SetInputAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(setInputAction.getName(), "selenium:set-input");
    Assert.assertEquals(setInputAction.getBy(), By.name("username"));
    Assert.assertEquals(setInputAction.getValue(), "Citrus");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            CheckInputAction.class);
    CheckInputAction checkInputAction = (CheckInputAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(checkInputAction.getName(), "selenium:check-input");
    Assert.assertEquals(checkInputAction.getBy(), By.xpath("//input[@type='checkbox']"));
    Assert.assertFalse(checkInputAction.isChecked());
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            JavaScriptAction.class);
    JavaScriptAction javaScriptAction = (JavaScriptAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(javaScriptAction.getName(), "selenium:javascript");
    Assert.assertEquals(javaScriptAction.getScript(), "alert('Hello!')");
    Assert.assertEquals(javaScriptAction.getExpectedErrors().size(), 1L);
    Assert.assertEquals(javaScriptAction.getExpectedErrors().get(0), "This went wrong!");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            AlertAction.class);
    AlertAction alertAction = (AlertAction) ((DelegatingTestAction) test.getActions().get(actionIndex++))
            .getDelegate();
    Assert.assertEquals(alertAction.getName(), "selenium:alert");
    Assert.assertEquals(alertAction.getText(), "Hello!");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            ClearBrowserCacheAction.class);
    ClearBrowserCacheAction clearBrowserCacheAction = (ClearBrowserCacheAction) ((DelegatingTestAction) test
            .getActions().get(actionIndex++)).getDelegate();
    Assert.assertEquals(clearBrowserCacheAction.getName(), "selenium:clear-cache");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            StoreFileAction.class);
    StoreFileAction storeFileAction = (StoreFileAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(storeFileAction.getName(), "selenium:store-file");
    Assert.assertEquals(storeFileAction.getFilePath(), "classpath:download/file.txt");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            GetStoredFileAction.class);
    GetStoredFileAction getStoredFileAction = (GetStoredFileAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(getStoredFileAction.getName(), "selenium:get-stored-file");
    Assert.assertEquals(getStoredFileAction.getFileName(), "file.txt");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            OpenWindowAction.class);
    OpenWindowAction openWindowAction = (OpenWindowAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(openWindowAction.getName(), "selenium:open-window");
    Assert.assertEquals(openWindowAction.getWindowName(), "my_window");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            SwitchWindowAction.class);
    SwitchWindowAction switchWindowAction = (SwitchWindowAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(switchWindowAction.getName(), "selenium:switch-window");
    Assert.assertEquals(switchWindowAction.getWindowName(), "my_window");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            CloseWindowAction.class);
    CloseWindowAction closeWindowAction = (CloseWindowAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(closeWindowAction.getName(), "selenium:close-window");
    Assert.assertEquals(closeWindowAction.getWindowName(), "my_window");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            WaitUntilAction.class);
    WaitUntilAction waitUntilAction = (WaitUntilAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(waitUntilAction.getName(), "selenium:wait");
    Assert.assertEquals(waitUntilAction.getBy(), By.name("hiddenButton"));
    Assert.assertEquals(waitUntilAction.getCondition(), "hidden");
    Assert.assertNotNull(findElementAction.getBrowser());

    Assert.assertEquals(((DelegatingTestAction) test.getActions().get(actionIndex)).getDelegate().getClass(),
            StopBrowserAction.class);
    StopBrowserAction stopBrowserAction = (StopBrowserAction) ((DelegatingTestAction) test.getActions()
            .get(actionIndex++)).getDelegate();
    Assert.assertEquals(stopBrowserAction.getName(), "selenium:stop");
    Assert.assertNotNull(stopBrowserAction.getBrowser());

    Assert.assertEquals(context.getVariable(SeleniumHeaders.SELENIUM_ALERT_TEXT), "Hello!");
    Assert.assertEquals(context.getVariable(SeleniumHeaders.SELENIUM_DOWNLOAD_FILE), "file.txt");
    Assert.assertEquals(context.getVariable(SeleniumHeaders.SELENIUM_LAST_WINDOW), "last_window");
    Assert.assertEquals(context.getVariable(SeleniumHeaders.SELENIUM_ACTIVE_WINDOW), "new_window");
    Assert.assertEquals(context.getVariable("my_window"), "new_window");

    verify(alert).accept();
    verify(options).deleteAllCookies();
    verify(link).click();
    verify(input).clear();
    verify(input).sendKeys("Citrus");
}

From source file:com.consol.citrus.selenium.actions.FindElementAction.java

License:Apache License

/**
 * Create by selector from type information.
 * @return//from  w  w w  .ja v  a 2 s .  c  o m
 */
protected By createBy(TestContext context) {
    if (by != null) {
        return by;
    }

    switch (property) {
    case "id":
        return By.id(context.replaceDynamicContentInString(propertyValue));
    case "class-name":
        return By.className(context.replaceDynamicContentInString(propertyValue));
    case "link-text":
        return By.linkText(context.replaceDynamicContentInString(propertyValue));
    case "css-selector":
        return By.cssSelector(context.replaceDynamicContentInString(propertyValue));
    case "name":
        return By.name(context.replaceDynamicContentInString(propertyValue));
    case "tag-name":
        return By.tagName(context.replaceDynamicContentInString(propertyValue));
    case "xpath":
        return By.xpath(context.replaceDynamicContentInString(propertyValue));
    }

    throw new CitrusRuntimeException("Unknown selector type: " + property);
}

From source file:com.consol.citrus.selenium.actions.FindElementActionTest.java

License:Apache License

@DataProvider
public Object[][] findByProvider() {
    return new Object[][] { new Object[] { "id", "myId", By.id("myId") },
            new Object[] { "name", "myName", By.name("myName") },
            new Object[] { "tag-name", "button", By.tagName("button") },
            new Object[] { "class-name", "myClass", By.className("myClass") },
            new Object[] { "link-text", "myLinkText", By.linkText("myLinkText") },
            new Object[] { "css-selector", "myCss", By.cssSelector("myCss") },
            new Object[] { "xpath", "myXpath", By.xpath("myXpath") } };
}

From source file:com.consol.citrus.selenium.client.WebClient.java

License:Apache License

public static By getByFromEnum(ByEnum byEnum, String select) {
    By by = null;//from   w  w w . j a  v a 2 s .  c om
    switch (byEnum) {
    case ID:
        by = By.id(select);
        break;
    case CLASS_NAME:
        by = By.className(select);
        break;
    case LINK_TEXT:
        by = By.linkText(select);
        break;
    case CSS_SELECTOR:
        by = By.cssSelector(select);
        break;
    case NAME:
        by = By.name(select);
        break;
    case TAG_NAME:
        by = By.tagName(select);
        break;
    case XPATH:
        by = By.xpath(select);
        break;
    }
    return by;
}

From source file:com.continuuity.test.TestUtil.java

License:Apache License

public WebElement getPanelHead(String linkText) {
    return globalDriver.findElement(By.linkText(linkText));
}

From source file:com.crawljax.plugins.testilizer.generated.claroline_EXND.GeneratedTestCase11.java

@Test
public void method11() {
    driver.get(url);/*w ww  . j  av a2  s.  c om*/
    //From state 0 to state 1
    //Eventable{eventType=click, identification=cssSelector button[type="submit"], element=Element{node=[BUTTON: null], tag=BUTTON, text=Enter, attributes={tabindex=3, type=submit}}, source=StateVertexImpl{id=0, name=index}, target=StateVertexImpl{id=1, name=state1}}
    mutateDOMTree(0);
    checkState0_OriginalAssertions();
    checkState0_ReusedAssertions();
    checkState0_GeneratedAssertions();
    checkState0_LearnedAssertions();
    checkState0_AllAssertions();
    checkState0_RandAssertions1();
    checkState0_RandAssertions2();
    checkState0_RandAssertions3();
    checkState0_RandAssertions4();
    checkState0_RandAssertions5();
    driver.findElement(By.id("login")).clear();
    driver.findElement(By.id("login")).sendKeys("nainy");
    driver.findElement(By.id("password")).clear();
    driver.findElement(By.id("password")).sendKeys("nainy");
    driver.findElement(By.cssSelector("button[type=\"submit\"]")).click();
    //From state 1 to state 2
    //Eventable{eventType=click, identification=text Platform administration, element=Element{node=[A: null], tag=A, text=Platform administration, attributes={href=/claroline-1.11.7/claroline/admin/, target=_top}}, source=StateVertexImpl{id=1, name=state1}, target=StateVertexImpl{id=2, name=state2}}
    mutateDOMTree(1);
    checkState1_OriginalAssertions();
    checkState1_ReusedAssertions();
    checkState1_GeneratedAssertions();
    checkState1_LearnedAssertions();
    checkState1_AllAssertions();
    checkState1_RandAssertions1();
    checkState1_RandAssertions2();
    checkState1_RandAssertions3();
    checkState1_RandAssertions4();
    checkState1_RandAssertions5();
    driver.findElement(By.linkText("Platform administration")).click();
    //From state 2 to state 107
    //Eventable{eventType=click, identification=text Modules, element=Element{node=[A: null], tag=A, text=Modules, attributes={href=module/module_list.php}}, source=StateVertexImpl{id=2, name=state2}, target=StateVertexImpl{id=107, name=state107}}
    mutateDOMTree(2);
    checkState2_OriginalAssertions();
    checkState2_ReusedAssertions();
    checkState2_GeneratedAssertions();
    checkState2_LearnedAssertions();
    checkState2_AllAssertions();
    checkState2_RandAssertions1();
    checkState2_RandAssertions2();
    checkState2_RandAssertions3();
    checkState2_RandAssertions4();
    checkState2_RandAssertions5();
    driver.findElement(By.linkText("Modules")).click();
    //From state 107 to state 108
    //Eventable{eventType=click, identification=cssSelector .claroTable > tbody:nth-child(2) > tr:nth-child(11) > td:nth-child(6) > a:nth-child(1) > img:nth-child(1), element=Element{node=[IMG: null], tag=IMG, text=, attributes={alt=Properties, src=/claroline-1.11.7/web/img/settings.png?1232379976}}, source=StateVertexImpl{id=107, name=state107}, target=StateVertexImpl{id=108, name=state108}}
    mutateDOMTree(107);
    checkState107_OriginalAssertions();
    checkState107_ReusedAssertions();
    checkState107_GeneratedAssertions();
    checkState107_LearnedAssertions();
    checkState107_AllAssertions();
    checkState107_RandAssertions1();
    checkState107_RandAssertions2();
    checkState107_RandAssertions3();
    checkState107_RandAssertions4();
    checkState107_RandAssertions5();
    driver.findElement(By.cssSelector(
            ".claroTable > tbody:nth-child(2) > tr:nth-child(11) > td:nth-child(6) > a:nth-child(1) > img:nth-child(1)"))
            .click();
    //From state 108 to state 151
    //Eventable{eventType=click, identification=text Local settings, element=Element{node=[A: null], tag=A, text=Local settings, attributes={href=module.php?module_id=11&item=LOCAL}}, source=StateVertexImpl{id=108, name=state108}, target=StateVertexImpl{id=151, name=state151}}
    mutateDOMTree(108);
    checkState108_OriginalAssertions();
    checkState108_ReusedAssertions();
    checkState108_GeneratedAssertions();
    checkState108_LearnedAssertions();
    checkState108_AllAssertions();
    checkState108_RandAssertions1();
    checkState108_RandAssertions2();
    checkState108_RandAssertions3();
    checkState108_RandAssertions4();
    checkState108_RandAssertions5();
    driver.findElement(By.linkText("Local settings")).click();
    //From state 151 to state 156
    //Eventable{eventType=click, identification=cssSelector input[type="submit"], element=Element{node=[INPUT: null], tag=INPUT, text=, attributes={type=submit, value=Ok}}, source=StateVertexImpl{id=151, name=state151}, target=StateVertexImpl{id=156, name=state156}}
    mutateDOMTree(151);
    checkState151_OriginalAssertions();
    checkState151_ReusedAssertions();
    checkState151_GeneratedAssertions();
    checkState151_LearnedAssertions();
    checkState151_AllAssertions();
    checkState151_RandAssertions1();
    checkState151_RandAssertions2();
    checkState151_RandAssertions3();
    checkState151_RandAssertions4();
    checkState151_RandAssertions5();
    driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();
    //From state 156 to state 160
    //Eventable{eventType=click, identification=text About, element=Element{node=[A: null], tag=A, text=About, attributes={href=module.php?module_id=11&item=About}}, source=StateVertexImpl{id=156, name=state156}, target=StateVertexImpl{id=160, name=state160}}
    mutateDOMTree(156);
    checkState156_OriginalAssertions();
    checkState156_ReusedAssertions();
    checkState156_GeneratedAssertions();
    checkState156_LearnedAssertions();
    checkState156_AllAssertions();
    checkState156_RandAssertions1();
    checkState156_RandAssertions2();
    checkState156_RandAssertions3();
    checkState156_RandAssertions4();
    checkState156_RandAssertions5();
    driver.findElement(By.linkText("About")).click();
    //From state 160 to state 87
    //Eventable{eventType=click, identification=text Logout, element=Element{node=[A: null], tag=A, text=Logout, attributes={href=/claroline-1.11.7/index.php?logout=true, target=_top}}, source=StateVertexImpl{id=160, name=state160}, target=StateVertexImpl{id=87, name=state87}}
    mutateDOMTree(160);
    checkState160_OriginalAssertions();
    checkState160_ReusedAssertions();
    checkState160_GeneratedAssertions();
    checkState160_LearnedAssertions();
    checkState160_AllAssertions();
    checkState160_RandAssertions1();
    checkState160_RandAssertions2();
    checkState160_RandAssertions3();
    checkState160_RandAssertions4();
    checkState160_RandAssertions5();
    driver.findElement(By.linkText("Logout")).click();
    //Sink node at state 87
    mutateDOMTree(87);
    checkState87_OriginalAssertions();
    checkState87_ReusedAssertions();
    checkState87_GeneratedAssertions();
    checkState87_LearnedAssertions();
    checkState87_AllAssertions();
    checkState87_RandAssertions1();
    checkState87_RandAssertions2();
    checkState87_RandAssertions3();
    checkState87_RandAssertions4();
    checkState87_RandAssertions5();
}

From source file:com.crawljax.plugins.testilizer.generated.claroline_EXND.GeneratedTestCase12.java

@Test
public void method12() {
    driver.get(url);//from  w  w w . j a va2  s .  c o  m
    //From state 0 to state 1
    //Eventable{eventType=click, identification=cssSelector button[type="submit"], element=Element{node=[BUTTON: null], tag=BUTTON, text=Enter, attributes={tabindex=3, type=submit}}, source=StateVertexImpl{id=0, name=index}, target=StateVertexImpl{id=1, name=state1}}
    mutateDOMTree(0);
    checkState0_OriginalAssertions();
    checkState0_ReusedAssertions();
    checkState0_GeneratedAssertions();
    checkState0_LearnedAssertions();
    checkState0_AllAssertions();
    checkState0_RandAssertions1();
    checkState0_RandAssertions2();
    checkState0_RandAssertions3();
    checkState0_RandAssertions4();
    checkState0_RandAssertions5();
    driver.findElement(By.id("login")).clear();
    driver.findElement(By.id("login")).sendKeys("nainy");
    driver.findElement(By.id("password")).clear();
    driver.findElement(By.id("password")).sendKeys("nainy");
    driver.findElement(By.cssSelector("button[type=\"submit\"]")).click();
    //From state 1 to state 2
    //Eventable{eventType=click, identification=text Platform administration, element=Element{node=[A: null], tag=A, text=Platform administration, attributes={href=/claroline-1.11.7/claroline/admin/, target=_top}}, source=StateVertexImpl{id=1, name=state1}, target=StateVertexImpl{id=2, name=state2}}
    mutateDOMTree(1);
    checkState1_OriginalAssertions();
    checkState1_ReusedAssertions();
    checkState1_GeneratedAssertions();
    checkState1_LearnedAssertions();
    checkState1_AllAssertions();
    checkState1_RandAssertions1();
    checkState1_RandAssertions2();
    checkState1_RandAssertions3();
    checkState1_RandAssertions4();
    checkState1_RandAssertions5();
    driver.findElement(By.linkText("Platform administration")).click();
    //From state 2 to state 107
    //Eventable{eventType=click, identification=text Modules, element=Element{node=[A: null], tag=A, text=Modules, attributes={href=module/module_list.php}}, source=StateVertexImpl{id=2, name=state2}, target=StateVertexImpl{id=107, name=state107}}
    mutateDOMTree(2);
    checkState2_OriginalAssertions();
    checkState2_ReusedAssertions();
    checkState2_GeneratedAssertions();
    checkState2_LearnedAssertions();
    checkState2_AllAssertions();
    checkState2_RandAssertions1();
    checkState2_RandAssertions2();
    checkState2_RandAssertions3();
    checkState2_RandAssertions4();
    checkState2_RandAssertions5();
    driver.findElement(By.linkText("Modules")).click();
    //From state 107 to state 108
    //Eventable{eventType=click, identification=cssSelector img[alt="Properties"], element=Element{node=[IMG: null], tag=IMG, text=, attributes={alt=Properties, src=/claroline-1.11.7/web/img/settings.png?1232379976}}, source=StateVertexImpl{id=107, name=state107}, target=StateVertexImpl{id=108, name=state108}}
    mutateDOMTree(107);
    checkState107_OriginalAssertions();
    checkState107_ReusedAssertions();
    checkState107_GeneratedAssertions();
    checkState107_LearnedAssertions();
    checkState107_AllAssertions();
    checkState107_RandAssertions1();
    checkState107_RandAssertions2();
    checkState107_RandAssertions3();
    checkState107_RandAssertions4();
    checkState107_RandAssertions5();
    driver.findElement(By.cssSelector("img[alt=\"Properties\"]")).click();
    //From state 108 to state 151
    //Eventable{eventType=click, identification=text Local settings, element=Element{node=[A: null], tag=A, text=Local settings, attributes={href=module.php?module_id=11&item=LOCAL}}, source=StateVertexImpl{id=108, name=state108}, target=StateVertexImpl{id=151, name=state151}}
    mutateDOMTree(108);
    checkState108_OriginalAssertions();
    checkState108_ReusedAssertions();
    checkState108_GeneratedAssertions();
    checkState108_LearnedAssertions();
    checkState108_AllAssertions();
    checkState108_RandAssertions1();
    checkState108_RandAssertions2();
    checkState108_RandAssertions3();
    checkState108_RandAssertions4();
    checkState108_RandAssertions5();
    driver.findElement(By.linkText("Local settings")).click();
    //From state 151 to state 156
    //Eventable{eventType=click, identification=cssSelector input[type="submit"], element=Element{node=[INPUT: null], tag=INPUT, text=, attributes={type=submit, value=Ok}}, source=StateVertexImpl{id=151, name=state151}, target=StateVertexImpl{id=156, name=state156}}
    mutateDOMTree(151);
    checkState151_OriginalAssertions();
    checkState151_ReusedAssertions();
    checkState151_GeneratedAssertions();
    checkState151_LearnedAssertions();
    checkState151_AllAssertions();
    checkState151_RandAssertions1();
    checkState151_RandAssertions2();
    checkState151_RandAssertions3();
    checkState151_RandAssertions4();
    checkState151_RandAssertions5();
    driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();
    //From state 156 to state 160
    //Eventable{eventType=click, identification=text About, element=Element{node=[A: null], tag=A, text=About, attributes={href=module.php?module_id=11&item=About}}, source=StateVertexImpl{id=156, name=state156}, target=StateVertexImpl{id=160, name=state160}}
    mutateDOMTree(156);
    checkState156_OriginalAssertions();
    checkState156_ReusedAssertions();
    checkState156_GeneratedAssertions();
    checkState156_LearnedAssertions();
    checkState156_AllAssertions();
    checkState156_RandAssertions1();
    checkState156_RandAssertions2();
    checkState156_RandAssertions3();
    checkState156_RandAssertions4();
    checkState156_RandAssertions5();
    driver.findElement(By.linkText("About")).click();
    //From state 160 to state 87
    //Eventable{eventType=click, identification=text Logout, element=Element{node=[A: null], tag=A, text=Logout, attributes={href=/claroline-1.11.7/index.php?logout=true, target=_top}}, source=StateVertexImpl{id=160, name=state160}, target=StateVertexImpl{id=87, name=state87}}
    mutateDOMTree(160);
    checkState160_OriginalAssertions();
    checkState160_ReusedAssertions();
    checkState160_GeneratedAssertions();
    checkState160_LearnedAssertions();
    checkState160_AllAssertions();
    checkState160_RandAssertions1();
    checkState160_RandAssertions2();
    checkState160_RandAssertions3();
    checkState160_RandAssertions4();
    checkState160_RandAssertions5();
    driver.findElement(By.linkText("Logout")).click();
    //Sink node at state 87
    mutateDOMTree(87);
    checkState87_OriginalAssertions();
    checkState87_ReusedAssertions();
    checkState87_GeneratedAssertions();
    checkState87_LearnedAssertions();
    checkState87_AllAssertions();
    checkState87_RandAssertions1();
    checkState87_RandAssertions2();
    checkState87_RandAssertions3();
    checkState87_RandAssertions4();
    checkState87_RandAssertions5();
}

From source file:com.crawljax.plugins.testilizer.generated.claroline_EXND.GeneratedTestCase19.java

@Test
public void method19() {
    driver.get(url);// w  w  w.j a va2  s.co  m
    //From state 0 to state 1
    //Eventable{eventType=click, identification=cssSelector button[type="submit"], element=Element{node=[BUTTON: null], tag=BUTTON, text=Enter, attributes={tabindex=3, type=submit}}, source=StateVertexImpl{id=0, name=index}, target=StateVertexImpl{id=1, name=state1}}
    mutateDOMTree(0);
    checkState0_OriginalAssertions();
    checkState0_ReusedAssertions();
    checkState0_GeneratedAssertions();
    checkState0_LearnedAssertions();
    checkState0_AllAssertions();
    checkState0_RandAssertions1();
    checkState0_RandAssertions2();
    checkState0_RandAssertions3();
    checkState0_RandAssertions4();
    checkState0_RandAssertions5();
    driver.findElement(By.id("login")).clear();
    driver.findElement(By.id("login")).sendKeys("nainy");
    driver.findElement(By.id("password")).clear();
    driver.findElement(By.id("password")).sendKeys("nainy");
    driver.findElement(By.cssSelector("button[type=\"submit\"]")).click();
    //From state 1 to state 2
    //Eventable{eventType=click, identification=text Platform administration, element=Element{node=[A: null], tag=A, text=Platform administration, attributes={href=/claroline-1.11.7/claroline/admin/, target=_top}}, source=StateVertexImpl{id=1, name=state1}, target=StateVertexImpl{id=2, name=state2}}
    mutateDOMTree(1);
    checkState1_OriginalAssertions();
    checkState1_ReusedAssertions();
    checkState1_GeneratedAssertions();
    checkState1_LearnedAssertions();
    checkState1_AllAssertions();
    checkState1_RandAssertions1();
    checkState1_RandAssertions2();
    checkState1_RandAssertions3();
    checkState1_RandAssertions4();
    checkState1_RandAssertions5();
    driver.findElement(By.linkText("Platform administration")).click();
    //From state 2 to state 107
    //Eventable{eventType=click, identification=text Modules, element=Element{node=[A: null], tag=A, text=Modules, attributes={href=module/module_list.php}}, source=StateVertexImpl{id=2, name=state2}, target=StateVertexImpl{id=107, name=state107}}
    mutateDOMTree(2);
    checkState2_OriginalAssertions();
    checkState2_ReusedAssertions();
    checkState2_GeneratedAssertions();
    checkState2_LearnedAssertions();
    checkState2_AllAssertions();
    checkState2_RandAssertions1();
    checkState2_RandAssertions2();
    checkState2_RandAssertions3();
    checkState2_RandAssertions4();
    checkState2_RandAssertions5();
    driver.findElement(By.linkText("Modules")).click();
    //From state 107 to state 108
    //Eventable{eventType=click, identification=cssSelector .claroTable > tbody:nth-child(2) > tr:nth-child(11) > td:nth-child(6) > a:nth-child(1) > img:nth-child(1), element=Element{node=[IMG: null], tag=IMG, text=, attributes={alt=Properties, src=/claroline-1.11.7/web/img/settings.png?1232379976}}, source=StateVertexImpl{id=107, name=state107}, target=StateVertexImpl{id=108, name=state108}}
    mutateDOMTree(107);
    checkState107_OriginalAssertions();
    checkState107_ReusedAssertions();
    checkState107_GeneratedAssertions();
    checkState107_LearnedAssertions();
    checkState107_AllAssertions();
    checkState107_RandAssertions1();
    checkState107_RandAssertions2();
    checkState107_RandAssertions3();
    checkState107_RandAssertions4();
    checkState107_RandAssertions5();
    driver.findElement(By.cssSelector(
            ".claroTable > tbody:nth-child(2) > tr:nth-child(11) > td:nth-child(6) > a:nth-child(1) > img:nth-child(1)"))
            .click();
    //From state 108 to state 151
    //Eventable{eventType=click, identification=text Local settings, element=Element{node=[A: null], tag=A, text=Local settings, attributes={href=module.php?module_id=11&item=LOCAL}}, source=StateVertexImpl{id=108, name=state108}, target=StateVertexImpl{id=151, name=state151}}
    mutateDOMTree(108);
    checkState108_OriginalAssertions();
    checkState108_ReusedAssertions();
    checkState108_GeneratedAssertions();
    checkState108_LearnedAssertions();
    checkState108_AllAssertions();
    checkState108_RandAssertions1();
    checkState108_RandAssertions2();
    checkState108_RandAssertions3();
    checkState108_RandAssertions4();
    checkState108_RandAssertions5();
    driver.findElement(By.linkText("Local settings")).click();
    //From state 151 to state 156
    //Eventable{eventType=click, identification=cssSelector input[type="submit"], element=Element{node=[INPUT: null], tag=INPUT, text=, attributes={type=submit, value=Ok}}, source=StateVertexImpl{id=151, name=state151}, target=StateVertexImpl{id=156, name=state156}}
    mutateDOMTree(151);
    checkState151_OriginalAssertions();
    checkState151_ReusedAssertions();
    checkState151_GeneratedAssertions();
    checkState151_LearnedAssertions();
    checkState151_AllAssertions();
    checkState151_RandAssertions1();
    checkState151_RandAssertions2();
    checkState151_RandAssertions3();
    checkState151_RandAssertions4();
    checkState151_RandAssertions5();
    driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();
    //From state 156 to state 160
    //Eventable{eventType=click, identification=text About, element=Element{node=[A: null], tag=A, text=About, attributes={href=module.php?module_id=11&item=About}}, source=StateVertexImpl{id=156, name=state156}, target=StateVertexImpl{id=160, name=state160}}
    mutateDOMTree(156);
    checkState156_OriginalAssertions();
    checkState156_ReusedAssertions();
    checkState156_GeneratedAssertions();
    checkState156_LearnedAssertions();
    checkState156_AllAssertions();
    checkState156_RandAssertions1();
    checkState156_RandAssertions2();
    checkState156_RandAssertions3();
    checkState156_RandAssertions4();
    checkState156_RandAssertions5();
    driver.findElement(By.linkText("About")).click();
    //Sink node at state 160
    mutateDOMTree(160);
    checkState160_OriginalAssertions();
    checkState160_ReusedAssertions();
    checkState160_GeneratedAssertions();
    checkState160_LearnedAssertions();
    checkState160_AllAssertions();
    checkState160_RandAssertions1();
    checkState160_RandAssertions2();
    checkState160_RandAssertions3();
    checkState160_RandAssertions4();
    checkState160_RandAssertions5();
}

From source file:com.crawljax.plugins.testilizer.generated.photogallery_EXND.GeneratedTestCase38.java

@Test
public void method38() {
    driver.get(url);//from ww w.j av  a  2  s.  c  om
    //From state 0 to state 13
    //Eventable{eventType=click, identification=text Admin Page, element=Element{node=[A: null], tag=A, text=Admin Page, attributes={href=admin.php, title=Login to the Administration Region}}, source=StateVertexImpl{id=0, name=index}, target=StateVertexImpl{id=13, name=state13}}
    mutateDOMTree(0);
    checkState0_OriginalAssertions();
    checkState0_ReusedAssertions();
    checkState0_GeneratedAssertions();
    checkState0_LearnedAssertions();
    checkState0_AllAssertions();
    checkState0_RandAssertions1();
    checkState0_RandAssertions2();
    checkState0_RandAssertions3();
    checkState0_RandAssertions4();
    checkState0_RandAssertions5();
    driver.findElement(By.linkText("Admin Page")).click();
    //From state 13 to state 14
    //Eventable{eventType=click, identification=cssSelector input.submit, element=Element{node=[INPUT: null], tag=INPUT, text=, attributes={class=submit, type=submit, value=??????Login??????}}, source=StateVertexImpl{id=13, name=state13}, target=StateVertexImpl{id=14, name=state14}}
    mutateDOMTree(13);
    checkState13_OriginalAssertions();
    checkState13_ReusedAssertions();
    checkState13_GeneratedAssertions();
    checkState13_LearnedAssertions();
    checkState13_AllAssertions();
    checkState13_RandAssertions1();
    checkState13_RandAssertions2();
    checkState13_RandAssertions3();
    checkState13_RandAssertions4();
    checkState13_RandAssertions5();
    driver.findElement(By.id("loginAdminPass")).clear();
    driver.findElement(By.id("loginAdminPass")).sendKeys("editor");
    driver.findElement(By.cssSelector("input.submit")).click();
    //Sink node at state 14
    mutateDOMTree(14);
    checkState14_OriginalAssertions();
    checkState14_ReusedAssertions();
    checkState14_GeneratedAssertions();
    checkState14_LearnedAssertions();
    checkState14_AllAssertions();
    checkState14_RandAssertions1();
    checkState14_RandAssertions2();
    checkState14_RandAssertions3();
    checkState14_RandAssertions4();
    checkState14_RandAssertions5();
}