Skip to content

Instantly share code, notes, and snippets.

@rodneyrehm
Last active July 25, 2016 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodneyrehm/23df2ae750ca5bac96f7ad93ffcf69bd to your computer and use it in GitHub Desktop.
Save rodneyrehm/23df2ae750ca5bac96f7ad93ffcf69bd to your computer and use it in GitHub Desktop.
BrowserStack: IE10 click problem

I have a functional test failing in IE10/Win8 on BrowserStack which has been driving me crazy. I ended up adding a few log statements to dojo/request/node in order to narrow down the problem.

The first code block shows .findById("first").click().end() that works fine (test), the second code block shows the problem (test). The request is taking ages and eventually fails.

The BrowserStack config is reduced to IE10 and IE11 and the only suite that is executed is element.disabled.test.js.

A few sessions that failed:

The branch in which the click failure occurs contains refactorings that should not concern Intern or the BrowserStack VMs. The document used by the failing test works fine when opened directly in IE10 (i.e. not via WebDriver).

The test (clicking the element) works when removing the nativeEvents option from the IE10 profile, as this session shows. But if I do that, other tests fail.

The test (clicking the element) also works fine when these lines (everything but the “svg*”) are commented out. I have no idea why removing that code should make a difference. It certainly doesn when IE10 is used directly.

--

Here's the successful part for comparison with the problematic attempt below

#
# Request 1: obtain the element
#

dojo/request https://<auth>@hub.browserstack.com:443/wd/hub/session/<session>/element
{
  followRedirects: false,
  handleAs: 'text',
  headers: {
    Accept: 'application/json,text/plain;q=0.9',
    'Content-Type': 'application/json;charset=UTF-8',
    'Content-Length': 30
  },
  method: 'POST',
  data: '{"using":"id","value":"first"}'
}

dojo/request response
  status: 200
  total: 173
  headers: {
    server: 'nginx/1.6.2',
    date: 'Tue, 21 Jun 2016 21:21:17 GMT',
    'content-type': 'application/json; charset=utf-8',
    'content-length': '173',
    connection: 'close',
    expires: 'Thu, 01 Jan 1970 00:00:00 GMT, Thu, 01 Jan 1970 00:00:00 GMT',
    'cache-control': 'no-cache, no-cache'
  }
dojo/request data
  loaded: 173
  chunk: {"state":"success","sessionId":"<session>","hCode":10384507,"value":{"ELEMENT":"14"},"class":"org.openqa.selenium.remote.Response","status":0}
dojo/request end


#
# Request 2: click the element
#

dojo/request https://<auth>@hub.browserstack.com:443/wd/hub/session/<session>/element/14/click
{
  followRedirects: false,
  handleAs: 'text',
  headers: {
    Accept: 'application/json,text/plain;q=0.9',
    'Content-Length': 0
  },
  method: 'POST'
}

dojo/request response
  status: 200
  total: 161
  header: {
    server: 'nginx/1.6.2',
    date: 'Tue, 21 Jun 2016 21:21:17 GMT',
    'content-type': 'application/json; charset=utf-8',
    'content-length': '161',
    connection: 'close',
    expires: 'Thu, 01 Jan 1970 00:00:00 GMT, Thu, 01 Jan 1970 00:00:00 GMT',
    'cache-control': 'no-cache, no-cache'
  }

dojo/request data
  loaded: 161
  chunk: {"state":"success","sessionId":"<session>","hCode":32561411,"value":null,"class":"org.openqa.selenium.remote.Response","status":0}
dojo/request end

And here's the second attempt to click an element. Note how the response of the request for click does not contain content-length header (which dojo/request/node turns into NaN and fails miserably):

#
# Request 1: obtain the element
#

dojo/request https://<auth>@hub.browserstack.com:443/wd/hub/session/<session>/element
{
  followRedirects: false,
  handleAs: 'text',
  headers: {
    Accept: 'application/json,text/plain;q=0.9',
    'Content-Type': 'application/json;charset=UTF-8',
    'Content-Length': 31
  },
  method: 'POST',
  data: '{"using":"id","value":"before"}'
}

dojo/request response
  status: 200
  total: 173
  headers: {
    server: 'nginx/1.6.2',
    date: 'Tue, 21 Jun 2016 21:21:28 GMT',
    'content-type': 'application/json; charset=utf-8',
    'content-length': '173',
    connection: 'close',
    expires: 'Thu, 01 Jan 1970 00:00:00 GMT, Thu, 01 Jan 1970 00:00:00 GMT',
    'cache-control': 'no-cache, no-cache'
  }
dojo/request data
  loaded: 173
  chunk: {"state":"success","sessionId":"<session>","hCode":20398814,"value":{"ELEMENT":"15"},"class":"org.openqa.selenium.remote.Response","status":0}
dojo/request end


#
# Request 2: click the element
#

dojo/request https://<auth>@hub.browserstack.com:443/wd/hub/session/<session>/element/15/click
{
  followRedirects: false,
  handleAs: 'text',
  headers: {
    Accept: 'application/json,text/plain;q=0.9',
    'Content-Length': 0
  },
  method: 'POST'
}

dojo/request response
  status: 200
  total: NaN
  headers: {
    server: 'nginx/1.6.2',
    date: 'Tue, 21 Jun 2016 21:21:59 GMT',
    'content-type': 'application/json; charset=utf-8',
    'transfer-encoding': 'chunked',
    connection: 'close',
    'cache-control': 'no-cache'
  }
dojo/request data
  loaded: 26
  chunk: 
dojo/request data
  loaded: 52
  chunk: 
dojo/request data
  loaded: 78
  chunk: 
dojo/request throwing
  CancelError: Timeout reached on IE10 on WIN - element/disabled - skips disabled elements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment