コード例 #1
0
  @Test
  public void testSetGUIDriver() throws Exception {
    ExtWebDriver otherwd = null;
    try {
      otherwd = SessionManager.getInstance().getNewSession(false);
      wd.open(url);
      otherwd.open(url);
      Element content = new Element(getDiv("content"));
      IInteractiveElement button = new Button(getButton("testWaitButton"));
      button.click();
      content.waitForText();
      String session1Str = content.getText();

      content.setGUIDriver(otherwd);

      content.waitForElementPresent();
      String session2Str = content.getText();

      Assert.assertNotEquals(
          "Test that Element successfully switched sessions", session1Str, session2Str);
    } finally {
      if (otherwd != null) {
        otherwd.close();
        SessionManager.getInstance().removeSession(otherwd);
      }
    }
  }
コード例 #2
0
  @Test
  public void testWaitForText() throws WidgetException {
    wd.open(url);
    IInteractiveElement clickButton = new Button(getButton("testWaitButton"));
    IElement element = new Element(getDiv("content"));

    clickButton.click();
    element.waitForText();
  }
コード例 #3
0
  @Test
  public void testWaitForAttributeNotEqualTo() throws WidgetException {
    wd.open(url);

    IInteractiveElement clickButton = new Button(getButton("attributeChanger"));
    IElement element = new Element(getDiv("content"));

    clickButton.click();
    element.waitForAttributeNotEqualTo("randomAttrib", "Hello");
  }
コード例 #4
0
  @Test
  public void testWaitForNotVisible() throws WidgetException {
    wd.open(url);

    IInteractiveElement clickButton = new Button(getButton("nonVisibilityTest"));
    IElement element = new Element(getButton("visibilityTest"));

    clickButton.click();
    element.waitForNotVisible();
  }
コード例 #5
0
  @Test
  public void testWaitForElementNotPresent() throws WidgetException {
    wd.open(url);

    IInteractiveElement clickButton = new Button(getButton("testWaitElementNotPresentButton"));
    IElement waitForElement = new Element(getSpan("someText"));

    clickButton.click();
    waitForElement.waitForElementNotPresent();
  }
コード例 #6
0
  @Test(expected = WidgetException.class)
  public void testWaitForElementPresentTimeout() throws WidgetException {
    wd.open(url);

    IInteractiveElement clickButton = new Button(getButton("testWaitButton"));
    IElement waitForElement = new Element(getSpan("failMe"));

    clickButton.click();
    waitForElement.waitForElementPresent();
  }
コード例 #7
0
  @Test
  public void testMouseMoveOut() throws WidgetException {
    wd.open(url);

    IInteractiveElement ie = new InteractiveElement(getDiv("dest"));
    IElement element = new Element(getDiv("content"));
    ie.waitForElementPresent();
    ie.mouseMove();
    ie.mouseMoveOut();
    Assert.assertEquals("Mouse Moved Out", element.getText());
  }
コード例 #8
0
  // Selenium issue #3604
  @Test
  public void testDragAndDrop() throws WidgetException {
    wd.open(url);

    IInteractiveElement ie = new InteractiveElement(getDiv("draggableText"));
    IInteractiveElement destination = new InteractiveElement(getDiv("dropBox"));
    ie.waitForElementPresent();
    destination.waitForElementPresent();
    ie.dragAndDrop(destination);
    destination.waitForText();
    Assert.assertEquals("dragged", destination.getText());
  }