8 ответов:
кросс-платформенное решение
во-первых, установить Launchy gem:
$ gem install launchyзатем, вы можете выполнить следующее:
require 'launchy' Launchy.open("http://stackoverflow.com")
решение только для Mac:
system("open", "http://stackoverflow.com/")или
`open http://stackoverflow.com/`
Это должно работать на большинстве платформ:
link = "Insert desired link location here" if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ system "start #{link}" elsif RbConfig::CONFIG['host_os'] =~ /darwin/ system "open #{link}" elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/ system "xdg-open #{link}" end
Только Для Windows Решение:
require 'win32ole' shell = WIN32OLE.new('Shell.Application') shell.ShellExecute(...)
Если это windows, и это IE, попробуйте это:http://rubyonwindows.blogspot.com/search/label/watir Также проверьте селен Рубин:http://selenium.rubyforge.org/getting-started.html
HTH
Comments