1

I'm facing a problem double clicking an element on Safari using Java / Webdriver 2.48.

The tests are working fine on IE, Chrome, and Firefox but Actions are not supported on Safari. Currently I'm doing something like this

executor.executeScript("arguments[0].dblclick();", element);

or

executor.executeScript("arguments[0].dblclick;", element);

but is not working. Here is the error

arguments[0].dblclick is not a function. (In 'arguments[0].dblclick()', 'arguments[0].dblclick' is undefined) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 35 milliseconds Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14' System info: host: 'MacBook-Pro.local', ip: '10.0.1.7', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11', java.version: '1.8.0_25' Driver info: org.openqa.selenium.safari.SafariDriver Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=9.0, cssSelectorsEnabled=true, platform=MAC, secureSsl=true}] Session ID: null

I tried with dblclick and ondblclick but the double click was not executed, see the previous error.

msiles
  • 657
  • 3
  • 10
  • 19
  • Possible duplicate of [Double click through javascript execution for Selenium](http://stackoverflow.com/questions/24749405/double-click-through-javascript-execution-for-selenium) – JeffC Oct 30 '15 at 03:01

1 Answers1

0

I was able to fix the issue using the following code

It works on Safari

var event = new MouseEvent('dblclick', {
'view': window,
'bubbles': true,
'cancelable': true
});

 document.querySelector("div[id='InProcessGrid']>div>table>tbody>tr.rowselected>td:nth-child(1)").dispatchEvent(event);

Here is more info about the issue

https://github.com/webdriverio/webdriverio/issues/231

msiles
  • 657
  • 3
  • 10
  • 19