diff --git a/lib/persistent_selenium/browser.rb b/lib/persistent_selenium/browser.rb index b91c122..11ed202 100644 --- a/lib/persistent_selenium/browser.rb +++ b/lib/persistent_selenium/browser.rb @@ -26,7 +26,10 @@ module PersistentSelenium def set_app_host(host) @app_host = host.dup + load_splash_page + end + def load_splash_page browser.navigate.to("data:text/html;base64,#{Base64.encode64(starting_page)}") end @@ -40,6 +43,10 @@ module PersistentSelenium # instead. end end + + GC.enable + GC.start + GC.disable end def starting_page diff --git a/lib/persistent_selenium/driver.rb b/lib/persistent_selenium/driver.rb index 3ef574f..93d8993 100644 --- a/lib/persistent_selenium/driver.rb +++ b/lib/persistent_selenium/driver.rb @@ -1,4 +1,8 @@ require 'persistent_selenium' +require 'capybara/selenium/driver' + +# make sure these classes exist on this end +[ Selenium::WebDriver::Error::StaleElementReferenceError, Selenium::WebDriver::Error::UnhandledError, Selenium::WebDriver::Error::ElementNotVisibleError ] Capybara.register_driver :persistent_selenium do |app| require 'drb'