Skip to content
4 changes: 2 additions & 2 deletions src/main/java/com/dougnoel/sentinel/elements/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class Element {
protected Map<SelectorType,String> selectors;
protected String name;
protected final String elementType;
private WebDriver driver() { return Driver.getWebDriver(); }
protected WebDriver driver() { return Driver.getWebDriver(); }

/**
* The constructor for a WebElement to initialize how an element is going to be
Expand Down Expand Up @@ -488,7 +488,7 @@ public Element dragAndDrop(Element target) throws IOException {

JavascriptExecutor executor = (JavascriptExecutor)WebDriverFactory.getWebDriver();
executor.executeScript(script, this.element(), target.element());
return this;
return this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.awt.Robot;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Map;

import com.dougnoel.sentinel.configurations.Time;
Expand Down Expand Up @@ -202,6 +203,19 @@ public Color getColorAtOffset() {
return getColorAtOffset(1, 1);
}

/**
* Drags the current element on top of the target element.
* @param target Element the element the target is being dragged and dropped onto
* @return Element (for chaining)
* @throws IOException if the drag and drop javascript file cannot be loaded
*/
@Override
public Element dragAndDrop(Element target) throws IOException {
new Actions(driver()).dragAndDrop(this.element(), target.element()).build().perform();

return this;
}

/**
* Returns true if the element has an attribute equal to the value passed;
* otherwise returns false.
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/com/microsoft/NotepadApp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ elements:
accessibilityid: 1025
class: msctls_statusbar32
file_menu_dropdown:
name: File
name: File
edit_menu_dropdown:
name: Edit