Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created July 22, 2019 23:31
Show Gist options
  • Save twalpole/ab163ea5f680306a50f554ecd62f3d6b to your computer and use it in GitHub Desktop.
Save twalpole/ab163ea5f680306a50f554ecd62f3d6b to your computer and use it in GitHub Desktop.
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'selenium-webdriver', '3.142.3'
end
pid = Process.pid
puts "pid: #{pid}"
puts `lsof -p #{pid} | grep TCP`
require 'selenium-webdriver'
def new_driver
driver_options = Selenium::WebDriver::Chrome::Options.new()
driver_capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(loggingPrefs: {performance: 'ALL'})
Selenium::WebDriver.for :chrome,
listener: -> (event_name, *args) { puts "heard #{event_name}, #{args}" },
options: driver_options,
desired_capabilities: driver_capabilities
end
10.times { new_driver.quit }
puts 'Pre GC'
puts `lsof -p #{pid} | grep TCP`
GC.start
puts 'After GC'
puts `lsof -p #{pid} | grep TCP`
puts "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment