El problema es que hay algo que Ocra está omitiendo (según parece algo de AutoIt), y aparte de eso watir se hace complicado de compilar con ocra así que...
usa el buscador de windows y copia la dll "autoitx3.dll" de la carpeta "win32ole" de Ruby, la copias junto a tu script para añadir manualmente la dll, así:
ocra navegante.rb AutoItX3.dll
Con este script:
# -*- coding: ISO-8859-1 -*-
require 'watir'
require 'watir-classic'
exit if Object.const_defined?(:Ocra)
AutoIt_dll = "\"" + File.dirname(__FILE__).gsub("/","\\")+"\\AutoItX3.dll" + "\""
if not ARGV.empty? then FILE = ARGV[0] else FILE = 'C:\Windows\Login.txt' end
File.open(FILE, 'r+').each_line do |line|
if line['URL'] then $URL = line.split('=').last.chomp.force_encoding("ISO-8859-1") end
if line['USER_TYPE'] then $USER_TYPE = line.split('=').last.chomp.force_encoding("ISO-8859-1").to_sym end
if line['USER_NAME'] then $USER_NAME = line.split('=').last.chomp.force_encoding("ISO-8859-1") end
if line['USER_TEXT'] then $USER_TEXT = line.split('=').last.chomp.force_encoding("ISO-8859-1") end
if line['PASS_TYPE'] then $PASS_TYPE = line.split('=').last.chomp.force_encoding("ISO-8859-1").to_sym end
if line['PASS_NAME'] then $PASS_NAME = line.split('=').last.chomp.force_encoding("ISO-8859-1") end
if line['PASS_TEXT'] then $PASS_TEXT = line.split('=').last.chomp.force_encoding("ISO-8859-1") end
if line['BUTTON_TYPE'] then $BUTTON_TYPE = line.split('=').last.chomp.force_encoding("ISO-8859-1").to_sym end
if line['BUTTON_NAME'] then $BUTTON_NAME = line.split('=').last.chomp.force_encoding("ISO-8859-1") end
if line['LINK1_TYPE'] then $LINK1_TYPE = line.split('=').last.chomp.force_encoding("ISO-8859-1").to_sym end
if line['LINK1_NAME'] then $LINK1_NAME = line.split('=').last.chomp.force_encoding("ISO-8859-1") end
if line['LINK2_TYPE'] then $LINK2_TYPE = line.split('=').last.chomp.force_encoding("ISO-8859-1").to_sym end
if line['LINK2_NAME'] then $LINK2_NAME = line.split('=').last.chomp.force_encoding("ISO-8859-1") end
end
print "
INFO:
[+] URL:
#{$URL}
[+] Usuario:
Atributo = #{$USER_TYPE}
Nombre = #{$USER_NAME}
Texto = #{$USER_TEXT}
[+] Contraseña:
Atributo = #{$PASS_TYPE}
Nombre = #{$PASS_NAME}
Texto = #{$PASS_TEXT}
[+] Botón:
Atributo = #{$BUTTON_TYPE}
Nombre = #{$BUTTON_NAME}
[+] Link 1:
Atributo = #{$LINK1_TYPE}
Nombre = #{$LINK1_NAME}
[+] Link 2:
Atributo = #{$LINK2_TYPE}
Nombre = #{$LINK2_NAME}
"
system("regsvr32 /s AutoIt_dll")
browser = Watir::Browser.new
browser.goto($URL)
browser.text_field($USER_TYPE => $USER_NAME).set $USER_TEXT
browser.text_field($PASS_TYPE => $PASS_NAME).set $PASS_TEXT
browser.button($BUTTON_TYPE=> $BUTTON_NAME).click
browser.link($LINK1_TYPE=> $LINK1_NAME).click
browser.link($LINK2_TYPE=> $LINK2_NAME).click
#browser.close
system("regsvr32 /u /s AutoIt_dll")
PD: A mi me tira error todo el rato del OLE porque no tengo internet explorer, pero creo que te debería funcionar como está.
saludos