ChromeDriver 76.0.3809.126 - moveto request fails "ECONNRESET Error: socket hang up" when mouse down on draggable DIV

292 views
Skip to first unread message

Wayne Plummer

unread,
Aug 28, 2019, 4:14:50 AM8/28/19
to ChromeDriver Users
Initially found in a complex UI automation framework in use at Squared Up, I have a consistent repro for this issue in a newly set up small Nighwatch project.

My new project uses the latest versions of Nightwatch, Selenium Server and Chromedriver:

ChromeDriver 76.0.3809.126 (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024})

The issue seems to occur when mouseButtonDown is called on a DIV with draggable=true and a subsequent call is made to "moveTo".

The single test is:

module.exports = {
'Test01 Title': function(browser) {
    const dragElCss = '#group';
    browser.waitForElementPresent(dragElCss)
browser.waitForElementVisible(dragElCss)
    browser.moveToElement(dragElCss, 4, 4);
    browser.mouseButtonDown(0);
    browser.pause(500);
    browser.moveTo(null, 100, 100);
    browser.pause(500);
    browser.mouseButtonUp(0);
    browser.pause(5000);
    browser.end();
}
};

Nightwatch verbose tracing shows that the moveto request times out:

 → Running [before]:
 → Completed [before].
Running:  Test01 Title

 → Running [beforeEach]:
 → Completed [beforeEach].

 → Running command: url ('http://snipped.com/wayne/dragtest.html')
   Request POST  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/url
   { url: 'http://snipped.com/wayne/dragtest.html' }
   Response 200 POST /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/url (260ms)
   { sessionId: 'eb17df8c23ae3df9db87a483e804c3f6',
     status: 0,
     value: null }
 → Completed command url ('http://snipped.com/wayne/dragtest.html') (261ms)

 → Running command: waitForElementPresent ('#group')
   Request POST  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/elements
   { using: 'css selector', value: '#group' }
   Response 200 POST /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/elements (38ms)
   { sessionId: 'eb17df8c23ae3df9db87a483e804c3f6',
     status: 0,
     value: [ { ELEMENT: '0.6309017681973943-1' } ] }
√ Element <#group> was present after 49 milliseconds.
 → Completed command waitForElementPresent ('#group') (53ms)

 → Running command: waitForElementVisible ('#group')
   Request POST  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/elements
   { using: 'css selector', value: '#group' }
   Response 200 POST /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/elements (12ms)
   { sessionId: 'eb17df8c23ae3df9db87a483e804c3f6',
     status: 0,
     value: [ { ELEMENT: '0.6309017681973943-1' } ] }
   Request GET  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/element/0.6309017681973943-1/displayed
   Response 200 GET /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/element/0.6309017681973943-1/displayed (17ms)
   { sessionId: 'eb17df8c23ae3df9db87a483e804c3f6',
     status: 0,
     value: true }
√ Element <#group> was visible after 35 milliseconds.
 → Completed command waitForElementVisible ('#group') (36ms)

 → Running command: moveToElement ('#group', 4, 4)
   Request POST  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/elements
   { using: 'css selector', value: '#group' }
   Response 200 POST /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/elements (12ms)
   { sessionId: 'eb17df8c23ae3df9db87a483e804c3f6',
     status: 0,
     value: [ { ELEMENT: '0.6309017681973943-1' } ] }
   Request POST  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/moveto
   { element: '0.6309017681973943-1', xoffset: 4, yoffset: 4 }
   Response 200 POST /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/moveto (18ms)
   { sessionId: 'eb17df8c23ae3df9db87a483e804c3f6',
     status: 0,
     value: null }
 → Completed command moveToElement ('#group', 4, 4) (35ms)

 → Running command: mouseButtonDown (0)
   Request POST  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/buttondown
   { button: 0 }
   Response 200 POST /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/buttondown (7ms)
   { sessionId: 'eb17df8c23ae3df9db87a483e804c3f6',
     status: 0,
     value: null }
 → Completed command mouseButtonDown (0) (10ms)

 → Running command: pause (500)
 → Completed command pause (500) (501ms)

 → Running command: moveTo (, 100, 100)
   Request POST  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/moveto
   { xoffset: 100, yoffset: 100 }
    POST  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/moveto - ECONNRESET
Error: socket hang up
    at createHangUpError (_http_client.js:323:15)
    at Socket.socketCloseListener (_http_client.js:364:25)
 Error while running .moveTo() protocol action: An unknown error has occurred.

 → Completed command moveTo (, 100, 100) (60117ms)

 → Running command: pause (500)
 → Completed command pause (500) (501ms)

 → Running command: mouseButtonUp (0)
   Request POST  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/buttonup
   { button: 0 }
   Response 200 POST /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6/buttonup (18489ms)
   { sessionId: 'eb17df8c23ae3df9db87a483e804c3f6',
     status: 0,
     value: null }
 → Completed command mouseButtonUp (0) (18494ms)

 → Running command: pause (5000)
 → Completed command pause (5000) (4999ms)

 → Running command: end ()

 → Running command: session ('delete', [Function])
   Request DELETE  /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6
   Response 200 DELETE /wd/hub/session/eb17df8c23ae3df9db87a483e804c3f6 (73ms)
   { sessionId: 'eb17df8c23ae3df9db87a483e804c3f6',
     status: 0,
     value: null }
 → Completed command end () (84ms)
 → Completed command session ('delete', [Function]) (82ms)
 → Running [afterEach]:
 → Completed [afterEach].

OK. 2 assertions passed. (1m 25s / 85139ms)
 → Running [after]:
 → Completed [after].
 Wrote report file to: reports\CHROME_76.0.3809.100_Windows_NT_test01.xml.
 Wrote log file to: C:\GitRepos\nightwatch-experiment\selenium-server.log.
 Selenium Server process closed.

The page under test is:
<html>
<head>
<title>Nightwatch Drag Test</title>
<script type="text/javascript">
window.addEventListener('load', (event) => {
console.log('page is fully loaded');
window.addEventListener("dragend", function(ev){
console.log(`dragend: (${ev.pageX}, ${ev.pageY})`);

const container = document.querySelector('#container');
const group = document.querySelector('#group');
group.style.left = `${ev.pageX - container.offsetLeft}px`;
group.style.top = `${ev.pageY - container.offsetTop}px`;
})
});
  
  </script>
</head>
<body>
<h1>Nightwatch Drag Test</h1>
<div id="container" style="position:relative;">
<div id="group" draggable="true" style="position:absolute; left: 100px; top: 100px; width: 400px; height: 240px; border:2px solid blue; background-color: lightgoldenrodyellow">
<div style="position:absolute; top: 16px; right: 16px; height: 24px; width: 24px; background-color: red;" title="delete group">
</div>
<div id="draghandle" style="position:absolute; top: 16px; left: 16px; height: 24px; width: 24px; background-color: green;" title="drag group">
X
</div>
<div style="position:absolute; top: 16px; left: 88px; height: 24px; width: 24px;">
<input type="text" islazy="true" value="web">
</div>
<div style="position:absolute; bottom: 16px; left: 88px; height: 24px; width: 24px;" title="Add a monitored object">
+
</div>
</div>
</div>
</body>
</html>

As a matter of interest, if I install script in the web page under test that responds to mouse-move events, I see that the mouse *does* get moved immediately in the browser-under-test, but the "moveto" POST request times out after about a minute!

This looks to me like a problem at the chrome end of things rather than a Selenium or Nighwatch issue.

Does anyone have any thoughts?

Thanks,
       Wayne Plummer

P.S> originally posted with title "Nightwatch drag/drop testing consistently provokes ECONNRESET "socket hang up" in "moveto" request", but I think that perhaps leading with the word "Nightwatch" was putting people off reading this?

T Crichton

unread,
Aug 28, 2019, 12:54:48 PM8/28/19
to ChromeDriver Users
Wayne, 
ChromeDriver doesn't support the HTML5 draggable="true" attribute. Javascript solutions for drag and drop do work, in general, but we don't have an official recommendation for a workaround.

Wayne Plummer

unread,
Aug 29, 2019, 5:48:01 AM8/29/19
to ChromeDriver Users
Thanks, Tim (if "thanks" is the right word here ;)

I tried removing the draggable attribute and, sure enough, the moveTos no longer hang. Of course I no longer get the drop event when I send the mouseButtonUp :(

This seems like a serious gap in functionality, do you have any idea how soon a fix is likely to be? (This is likely to have a significant effect on our test automation strategy).

Regards,
         Wayne

T Crichton

unread,
Aug 29, 2019, 11:25:39 AM8/29/19
to ChromeDriver Users
Unfortunately, no, I don't have a estimated date. The last note on the ChromeDriver bug says it needs a Chrome change.
I know that's not good news, either.

vidhy...@gmail.com

unread,
Jan 27, 2020, 11:49:04 AM1/27/20
to ChromeDriver Users
Chrome driver 79 also still has the same issues..any fixes for the future please???
Reply all
Reply to author
Forward
0 new messages