Skip to content

Commit

Permalink
issue #77: add double click in javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
s047432 authored and s047432 committed Jan 24, 2018
1 parent 97247d1 commit b0e2420
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ public void setFileDetector(final FileDetector detector) {
fileDetector = detector;
}

/**
* Method for updating window handles when an operation may create a new window (a click action)
* This is called for Composite actions, native actions (from DriverListener) and JS actions
*/
public void updateWindowsHandles() {
if (isWebTest) {
// workaround for ios tests where getWindowHandles sometimes fails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ public void simulateClick() {
WaitHelper.waitForSeconds(2);
}

@ReplayOnError
public void simulateDoubleClick() {
findElement(true);

JavascriptExecutor js = (JavascriptExecutor) driver;
String script = "if(document.createEvent){var evObj = document.createEvent('MouseEvents');evObj.initEvent('dblclick', true, false); arguments[0].dispatchEvent(evObj);} else if(document.createEventObject) { arguments[0].fireEvent('ondblclick');}";
js.executeScript(script, element);

}

@ReplayOnError
public void simulateSendKeys(CharSequence... keysToSend) {
findElement(true);
Expand Down

0 comments on commit b0e2420

Please sign in to comment.