Skip to content

Instantly share code, notes, and snippets.

@dachi-gh
Created September 8, 2013 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dachi-gh/6486391 to your computer and use it in GitHub Desktop.
Save dachi-gh/6486391 to your computer and use it in GitHub Desktop.
selenium-webdriver threaded script execution fails
puts '--start'
profile = Selenium::WebDriver::Firefox::Profile.new
driver = Selenium::WebDriver.for :firefox, :profile => profile
timeout = Thread.new(Time.now + 7) do |end_time|
while Time.now < end_time
Thread.pass
end
puts '--execute'
puts driver.execute_script("return window.screen.__defineGetter__('height', function(){return 1080;});")
# at this point stream closes with "error: closed stream" message in console
end
process = Thread.new do
driver.navigate.to url
end
process.join
timeout.join
driver.quit
puts '--end'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment