1
Actions actions = new Actions(getDriver());

actions.moveByOffset(700,700);
actions.click().build().perform();


actions.moveByOffset(40,0);
actions.click().build().perform();

actions.moveByOffset(0,40);
actions.click().build().perform();


actions.moveByOffset(0,0);
actions.doubleClick().build().perform();

I can make it click but can't make it double click.

Do you have any idea ? How can i change this part of code .I need to double click any where on web page. Just a double click action .

actions.moveByOffset(0,0);
actions.doubleClick().build().perform();
Ali Azam
  • 2,047
  • 1
  • 16
  • 25
Anoretu
  • 75
  • 1
  • 9

2 Answers2

2

As per the Java Docs of current build of Selenium Java Client v3.8.1 you cannot use public Actions doubleClick() as the documentation clearly mentions that DoubleClickAction is Deprecated. Here is the snapshot :

doubleClick

Hence you may not be able to invoke doubleClick() from Package org.openqa.selenium.interactions

Solution :

If you need to execute doubleClick() two possible solutions are available as follows :

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • How am going to invoke a JavaScript code from Java ? – Anoretu Dec 26 '17 at 15:23
  • It says right there in the docs what the alternative is... Use [Actions.doubleClick(WebElement)](http://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/interactions/Actions.html#doubleClick-org.openqa.selenium.WebElement-) – JeffC Dec 26 '17 at 17:08
  • @JeffC The snapshot of `DoubleClickAction` which I have added in my `Answer` right from the beginning clearly mentions about the instruction to use **`Actions.doubleClick(WebElement)`** as an alternative. I have changed the verbatim of the Answer to make the even more clearer. Definitely **JavascriptExecutor** is a potential alternative. Let me know your thoughts about it. – undetected Selenium Dec 26 '17 at 19:50
0

You have to pass element argument to doubleClick() menthod.

actions.doubleClick(anyClickableWebElement).build().perform();
Sumit Shitole
  • 110
  • 1
  • 3
  • 20