Created
September 8, 2013 16:53
-
-
Save dachi-gh/6486391 to your computer and use it in GitHub Desktop.
selenium-webdriver threaded script execution fails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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