Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrowserStackLocal process not finishes, if there are any test errors #23

Open
SlavikCA opened this issue Dec 12, 2018 · 4 comments
Open

Comments

@SlavikCA
Copy link

I'm starting BrowserStackLocal process via local.runner.js.
It works fine most of the cases.
But it any of my tests fails, such as this:

Response 500 POST http://hub-cloud.browserstack.com/wd/hub/session/1c2be4573b0441648ac6dc73fd8cf8a799f70915/element   
{ state: 'no such element', ...

Then I have 5 BrowserStackLocal processes running:

sfursov-mac:node1 sfursov$ ps aux | grep browsersta
sfursov          14027   0.0  0.3  4904768  55432   ??  S    12:59PM   0:00.74 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/node1/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-4
sfursov          14026   0.0  0.3  4903388  55252   ??  S    12:59PM   0:00.81 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/node1/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-3
sfursov          14025   0.0  0.3  4904768  55420   ??  S    12:59PM   0:00.75 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/node1/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-2
sfursov          14024   0.0  0.3  4904768  55412   ??  S    12:59PM   0:00.76 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/node1/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-1
sfursov          14023   0.0  0.3  4904768  55528   ??  S    12:59PM   0:00.74 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/node1/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-0
sfursov          14011   0.0  0.3  4904636  57092   ??  Ss   12:59PM   0:00.63 /Users/sfursov/.browserstack/BrowserStackLocal --daemon start --log-file /Users/sfursov/code/node1/local.log--key ***** -daemonInstance

And if I try to run tests again, I'm getting:

sfursov-mac:node1 sfursov$ ./local.runner.js --env chrome
Connecting local

/Users/sfursov/code/node1/local.runner.js:14
    if (error) throw error;
               ^
LocalError: Either another browserstack local client is running on your machine or some server is listening on port 45691
    at /Users/sfursov/code/node1/node_modules/browserstack-local/lib/Local.js:58:20
    at ChildProcess.exithandler (child_process.js:267:7)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

until I kill all running BrowserStackLocal processes

@SlavikCA
Copy link
Author

Hm, I noticed, that issue reproduced, if Selenium error has status: 7
Not reproduced, if the error status: 32

Full output for status 7:

   Response 500 POST http://hub-cloud.browserstack.com/wd/hub/session/1c2be4573b0441648ac6dc73fd8cf8a799f70915/element (857ms)
   { state: 'no such element',
     sessionId: '1c2be4573b0441648ac6dc73fd8cf8a799f70915',
     value:
      { systemInformation: 'System info: host: \'185-129-68-219\', ip: \'185.129.68.219\', os.name: \'windows\', os.arch: \'x86\', os.version: \'5.2\', java.version: \'1.8.0_40\'',
        message: 'no such element: Unable to locate element: {"method":"xpath","selector":"@title"}',
        error:
         [ '  (Session info: chrome=49.0.2623.75)',
           '  (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 5.2 SP2 x86) (WARNING: The server did not provide any stacktrace information)',
           'Command duration or timeout: 31 milliseconds',
           'For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html',
           'Build info: version: \'2.53.0\', revision: \'35ae25b\', time: \'2016-03-15 17:00:58\'',
           'System info: host: \'185-129-68-219\', ip: \'185.129.68.219\', os.name: \'windows\', os.arch: \'x86\', os.version: \'5.2\', java.version: \'1.8.0_40\'',
           'Driver info: org.openqa.selenium.chrome.ChromeDriver',
           'Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:\\Windows\\proxy\\scoped_dir4976_2389}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=49.0.2623.75, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]',
           'Session ID: 8ec2c7b93611196f73ea0e56c9387689',
           '*** Element info: {Using=xpath, value=@title}' ] },
     status: 7 }
{ status: -1,
  state: 'no such element',
  value:
   { systemInformation: 'System info: host: \'185-129-68-219\', ip: \'185.129.68.219\', os.name: \'windows\', os.arch: \'x86\', os.version: \'5.2\', java.version: \'1.8.0_40\'',
     message: 'no such element: Unable to locate element: {"method":"xpath","selector":"@title"}',
     error:
      [ '  (Session info: chrome=49.0.2623.75)',
        '  (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 5.2 SP2 x86) (WARNING: The server did not provide any stacktrace information)',
        'Command duration or timeout: 31 milliseconds',
        'For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html',
        'Build info: version: \'2.53.0\', revision: \'35ae25b\', time: \'2016-03-15 17:00:58\'',
        'System info: host: \'185-129-68-219\', ip: \'185.129.68.219\', os.name: \'windows\', os.arch: \'x86\', os.version: \'5.2\', java.version: \'1.8.0_40\'',
        'Driver info: org.openqa.selenium.chrome.ChromeDriver',
        'Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:\\Windows\\proxy\\scoped_dir4976_2389}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=49.0.2623.75, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]',
        'Session ID: 8ec2c7b93611196f73ea0e56c9387689',
        '*** Element info: {Using=xpath, value=@title}' ] },
  errorStatus: 7,
  error: 'no such element: Unable to locate element: {"method":"xpath","selector":"@title"}',
  httpStatusCode: 500 }
sfursov-mac:node1 sfursov$

Full output for status 32:

   Response 500 POST http://hub-cloud.browserstack.com/wd/hub/session/ec303ccaf449713f4b9e4f21f7182e6f2d7eee6c/element (933ms)
   { state: 'invalid selector',
     sessionId: 'ec303ccaf449713f4b9e4f21f7182e6f2d7eee6c',
     value:
      { systemInformation: 'System info: host: \'185-44-131-224\', ip: \'185.44.131.224\', os.name: \'windows\', os.arch: \'x86\', os.version: \'5.2\', java.version: \'1.8.0_40\'',
        message: 'invalid selector: An invalid or illegal selector was specified',
        error:
         [ '  (Session info: chrome=49.0.2623.75)',
           '  (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 5.2 SP2 x86) (WARNING: The server did not provide any stacktrace information)',
           'Command duration or timeout: 32 milliseconds',
           'For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html',
           'Build info: version: \'2.53.0\', revision: \'35ae25b\', time: \'2016-03-15 17:00:58\'',
           'System info: host: \'185-44-131-224\', ip: \'185.44.131.224\', os.name: \'windows\', os.arch: \'x86\', os.version: \'5.2\', java.version: \'1.8.0_40\'',
           'Driver info: org.openqa.selenium.chrome.ChromeDriver',
           'Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:\\Windows\\proxy\\scoped_dir2520_14174}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=49.0.2623.75, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]',
           'Session ID: de6cce37a10873ba6583416cef3b5c2b',
           '*** Element info: {Using=css selector, value=@username}' ] },
     status: 32 }
 Error while running .locateSingleElement() protocol action: invalid selector: An invalid or illegal selector was specified

   An error occurred while running .getValue() command on <@username>: invalid selector: An invalid or illegal selector was specified
       at <anonymous>
       at process._tickCallback (internal/process/next_tick.js:188:7)
{ status: -1,
  state: 'invalid selector',
  value:
   { systemInformation: 'System info: host: \'185-44-131-224\', ip: \'185.44.131.224\', os.name: \'windows\', os.arch: \'x86\', os.version: \'5.2\', java.version: \'1.8.0_40\'',
     message: 'invalid selector: An invalid or illegal selector was specified',
     error:
      [ '  (Session info: chrome=49.0.2623.75)',
        '  (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 5.2 SP2 x86) (WARNING: The server did not provide any stacktrace information)',
        'Command duration or timeout: 32 milliseconds',
        'For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html',
        'Build info: version: \'2.53.0\', revision: \'35ae25b\', time: \'2016-03-15 17:00:58\'',
        'System info: host: \'185-44-131-224\', ip: \'185.44.131.224\', os.name: \'windows\', os.arch: \'x86\', os.version: \'5.2\', java.version: \'1.8.0_40\'',
        'Driver info: org.openqa.selenium.chrome.ChromeDriver',
        'Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:\\Windows\\proxy\\scoped_dir2520_14174}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=49.0.2623.75, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]',
        'Session ID: de6cce37a10873ba6583416cef3b5c2b',
        '*** Element info: {Using=css selector, value=@username}' ] },
  errorStatus: 32,
  error: 'invalid selector: An invalid or illegal selector was specified',
  httpStatusCode: 500 }


FAILED: 1 errors and  1 passed (32.272s)
_________________________________________________

TEST FAILURE: 1 error during execution 0 assertions failed, 1 passed. 36.688s

 ✖ test1
 – App 1st page shall be login page (32.272s)

  An error occurred while running .getValue() command on <@username>: invalid selector: An invalid or illegal selector was specified
       at <anonymous>
       at process._tickCallback (internal/process/next_tick.js:188:7)


sfursov-mac:node1 sfursov$

@vedharish
Copy link
Contributor

@SlavikCA Can you check if the local.runner.js script in PR #24 fixes your issue

@SlavikCA
Copy link
Author

SlavikCA commented Dec 13, 2018

Issue still happens, even when using script from PR #24

fursov-mac:night_test sfursov$ ./local.runner.js
Connecting local
Connected. Now testing...
processing config: default
processing config: chrome_local
processing config: chrome
processing config: firefox
processing config: safari
processing config: ie

[Test1] Test Suite
==================
Running:  App 1st page shall be login page

before login page
✔ Testing if the page title equals "Identity Cloud Service"  - 994 ms.
Using user: *****
Let`s try to read user
   Response 500 POST http://hub-cloud.browserstack.com/wd/hub/session/778d2345f73422eb15b6368646ffcfcfe2d41796/element (488ms)
   { state: 'invalid selector',
     sessionId: null,
     value:
      { systemInformation: 'System info: host: \'207-254-11-223\', ip: \'207.254.11.223\', os.name: \'windows\', os.arch: \'x86\', os.version: \'10.0\', java.version: \'1.8.0_181\'',
        message: 'Given css selector expression "@title" is invalid: InvalidSelectorError: \'@title\' is not a valid selector: "@title"',
        error:
         [ 'For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html',
           'Build info: version: \'3.11.0\', revision: \'e59cfb3\', time: \'2018-03-11T20:33:15.31Z\'',
           'System info: host: \'207-254-11-223\', ip: \'207.254.11.223\', os.name: \'windows\', os.arch: \'x86\', os.version: \'10.0\', java.version: \'1.8.0_181\'',
           'Driver info: driver.version: unknown' ] },
     status: 32 }
 Error while running .locateSingleElement() protocol action: Given css selector expression "@title" is invalid: InvalidSelectorError: '@title' is not a valid selector: "@title"

   An error occurred while running .getValue() command on <@title>: Given css selector expression "@title" is invalid: InvalidSelectorError: '@title' is not a valid selector: "@title"
       at <anonymous>
       at process._tickCallback (internal/process/next_tick.js:188:7)
{ status: -1,
  state: 'invalid selector',
  value:
   { systemInformation: 'System info: host: \'207-254-11-223\', ip: \'207.254.11.223\', os.name: \'windows\', os.arch: \'x86\', os.version: \'10.0\', java.version: \'1.8.0_181\'',
     message: 'Given css selector expression "@title" is invalid: InvalidSelectorError: \'@title\' is not a valid selector: "@title"',
     error:
      [ 'For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html',
        'Build info: version: \'3.11.0\', revision: \'e59cfb3\', time: \'2018-03-11T20:33:15.31Z\'',
        'System info: host: \'207-254-11-223\', ip: \'207.254.11.223\', os.name: \'windows\', os.arch: \'x86\', os.version: \'10.0\', java.version: \'1.8.0_181\'',
        'Driver info: driver.version: unknown' ] },
  errorStatus: 32,
  error: 'Given css selector expression "@title" is invalid: InvalidSelectorError: \'@title\' is not a valid selector: "@title"',
  httpStatusCode: 500 }
   Response 500 POST http://hub-cloud.browserstack.com/wd/hub/session/778d2345f73422eb15b6368646ffcfcfe2d41796/elements (289ms)
   { state: 'invalid selector',
     sessionId: null,
     value:
      { systemInformation: 'System info: host: \'207-254-11-223\', ip: \'207.254.11.223\', os.name: \'windows\', os.arch: \'x86\', os.version: \'10.0\', java.version: \'1.8.0_181\'',
        message: 'Given css selector expression "@title" is invalid: SyntaxError: \'@title\' is not a valid selector',
        error:
         [ 'For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html',
           'Build info: version: \'3.11.0\', revision: \'e59cfb3\', time: \'2018-03-11T20:33:15.31Z\'',
           'System info: host: \'207-254-11-223\', ip: \'207.254.11.223\', os.name: \'windows\', os.arch: \'x86\', os.version: \'10.0\', java.version: \'1.8.0_181\'',
           'Driver info: driver.version: unknown' ] },
     status: 32 }
 Error while running .locateMultipleElements() protocol action: Given css selector expression "@title" is invalid: SyntaxError: '@title' is not a valid selector

sfursov-mac:night_test sfursov$ ps aux | grep BrowserStack
sfursov          53765   0.0  0.3  4904768  54644   ??  S    11:28PM   0:00.69 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/night_test/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-0
sfursov          53753   0.0  0.3  4905660  56164   ??  Ss   11:28PM   0:00.52 /Users/sfursov/.browserstack/BrowserStackLocal --daemon start --log-file /Users/sfursov/code/night_test/local.log --key ***** -daemonInstance
sfursov          53891   0.0  0.0  4267752    888 s000  S+   11:29PM   0:00.00 grep BrowserStack
sfursov          53769   0.0  0.3  4904768  54480   ??  S    11:28PM   0:00.68 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/night_test/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-4
sfursov          53768   0.0  0.3  4904768  54368   ??  S    11:28PM   0:00.68 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/night_test/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-3
sfursov          53767   0.0  0.3  4904768  54592   ??  S    11:28PM   0:00.69 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/night_test/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-2
sfursov          53766   0.0  0.3  4904768  56004   ??  S    11:28PM   0:00.75 /Users/sfursov/.browserstack/BrowserStackLocal --log-file /Users/sfursov/code/night_test/local.log --key ***** -daemonInstance --local-identifier browserstack-fork-1
sfursov-mac:night_test sfursov$

@ituradastra
Copy link

Issue still happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants