selenium.cr icon indicating copy to clipboard operation
selenium.cr copied to clipboard

Handle when underlying chromedriver process is closed

Open matthewmcgarvey opened this issue 3 years ago • 1 comments

I was running a spec suite that used a mix of headless and non-headless specs. I think they use the same process so when the suite finished and it went through the drivers to close them, the first successfully closed the process but the next one raised an error.

Unhandled exception: Error connecting to 'localhost:9515': Connection refused (Socket::ConnectError)
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/socket/addrinfo.cr:73:15 in 'initialize'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/socket/tcp_socket.cr:27:3 in 'new'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/http/client.cr:779:5 in 'io'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/http/client.cr:664:5 in 'send_request'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/http/client.cr:599:5 in 'exec_internal_single'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/http/client.cr:586:5 in 'exec_internal'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/http/client.cr:581:7 in 'exec'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/http/client.cr:706:5 in 'exec'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/http/client.cr:738:7 in 'exec'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/http/client.cr:406:3 in 'delete'
  from lib/selenium/src/selenium/http_client.cr:19:5 in 'delete'
  from lib/selenium/src/selenium/command_handler.cr:20:7 in 'execute'
  from lib/selenium/src/selenium/command_handler.cr:12:5 in 'execute'
  from lib/selenium/src/selenium/session.cr:30:5 in 'delete'
  from src/lucky_flow/driver.cr:17:20 in 'shutdown'
  from src/lucky_flow/registry.cr:18:38 in 'shutdown_all'
  from src/lucky_flow.cr:202:5 in 'shutdown'
  from spec/spec_helper.cr:29:3 in '->'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/int.cr:541:7 in 'run_after_all_hooks'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/spec/context.cr:19:7 in 'internal_run'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/spec/context.cr:147:7 in 'run'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/spec/dsl.cr:274:7 in '->'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/primitives.cr:255:3 in 'run'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/crystal/main.cr:45:14 in 'main'
  from /Users/matthew/.asdf/installs/crystal/0.36.1/src/crystal/main.cr:119:3 in 'main'

matthewmcgarvey avatar Jan 13 '22 03:01 matthewmcgarvey

The error is pointing towards the more important issue of #21 but it still should not fail like this. If the process is dead, there's nothing to stop. Job done 🤷

matthewmcgarvey avatar Jan 13 '22 04:01 matthewmcgarvey