From a05bc7a93cf9f54bfa2792434663902019c4f343 Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Sun, 22 Oct 2023 08:26:26 -0700 Subject: [PATCH] Setting the remote debug port for headless chrome (#159) * Fixing hanging specs by specifying the remote debug port. You can use an ENV to override it if you need. Fixes #158 * updating Ameba --- shard.yml | 6 +++--- src/lucky_flow/selenium/chrome/driver.cr | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/shard.yml b/shard.yml index 8530cc8..be80b91 100644 --- a/shard.yml +++ b/shard.yml @@ -11,10 +11,10 @@ license: MIT dependencies: selenium: github: crystal-loot/selenium.cr - version: ~> 0.12.0 + version: ~> 0.12 webdrivers: github: crystal-loot/webdrivers.cr - version: ~> 0.4.2 + version: ~> 0.4 habitat: github: luckyframework/habitat version: ~> 0.4.7 @@ -27,4 +27,4 @@ dependencies: development_dependencies: ameba: github: crystal-ameba/ameba - version: ~> 1.4.3 + version: ~> 1.5 diff --git a/src/lucky_flow/selenium/chrome/driver.cr b/src/lucky_flow/selenium/chrome/driver.cr index 6cae6e8..ee52fc8 100644 --- a/src/lucky_flow/selenium/chrome/driver.cr +++ b/src/lucky_flow/selenium/chrome/driver.cr @@ -24,6 +24,7 @@ end LuckyFlow::Registry.register :headless_chrome do LuckyFlow::Selenium::Chrome::Driver.new do |config| - config.chrome_options.args = ["no-sandbox", "headless", "disable-gpu"] + remote_debuggin_port = ENV["CHROME_REMOTE_DEBUGGING_PORT"]? || 9222 + config.chrome_options.args = ["no-sandbox", "headless", "disable-gpu", "remote-debugging-port=#{remote_debuggin_port}"] end end