Skip to content

Commit

Permalink
drag and dropsupport
Browse files Browse the repository at this point in the history
  • Loading branch information
Caue Guerra committed Apr 20, 2009
1 parent 061dc1b commit 8298ec5
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 57 deletions.
15 changes: 15 additions & 0 deletions src/main/java/br/com/caelum/seleniumdsl/DefaultPage.java
Expand Up @@ -81,4 +81,19 @@ public Page refresh() {
return this;
}

public Page dragAndDrop(String fromElement, String toElement) {
selenium.dragAndDrop(fromElement, toElement);
return this;
}

public Page mouseDown(String element) {
selenium.mouseDown(element);
return this;
}

public Page mouseUp(String element) {
selenium.mouseUp(element);
return this;
}

}
15 changes: 15 additions & 0 deletions src/main/java/br/com/caelum/seleniumdsl/Page.java
Expand Up @@ -123,5 +123,20 @@ public interface Page {
* Simulates the user clicking the "Refresh" button on their browser.
*/
Page refresh();

/**
* Simulates the user pressing the mouse and holding on the designated element.
*/
Page mouseDown(String element);

/**
* Simulates the user releasing the mouseon the designated element.
*/
Page mouseUp(String element);

/**
* Simulates the user dragging and dropping.
*/
Page dragAndDrop(String fromElement, String toElement);

}
Expand Up @@ -10,7 +10,6 @@
import br.com.caelum.seleniumdsl.Form;
import br.com.caelum.seleniumdsl.Page;
import br.com.caelum.seleniumdsl.js.Array;
import br.com.caelum.seleniumdsl.js.HtmlUnitArray;
import br.com.caelum.seleniumdsl.table.Table;

import com.gargoylesoftware.htmlunit.ElementNotFoundException;
Expand Down Expand Up @@ -58,6 +57,24 @@ public Page click(String element) {
return this;
}

public HtmlUnitPage mouseDown(String element) {
ClickableElement div = page.getHtmlElementById(element);
div.mouseDown();
return this;
}

public HtmlUnitPage mouseUp(String element) {
ClickableElement div = page.getHtmlElementById(element);
div.mouseUp();
return this;
}

public HtmlUnitPage dragAndDrop(String fromElement, String toElement) {
mouseDown(fromElement);
mouseUp(toElement);
return this;
}

public Page doubleClick(String element) {
ClickableElement link = page.getHtmlElementById(element);
try {
Expand Down
27 changes: 0 additions & 27 deletions src/main/java/br/com/caelum/seleniumdsl/js/HtmlUnitArray.java

This file was deleted.

29 changes: 0 additions & 29 deletions src/main/java/br/com/caelum/seleniumdsl/js/HtmlUnitElement.java

This file was deleted.

0 comments on commit 8298ec5

Please sign in to comment.