Al compilarlo no da error, es al ejecutar el exe, abre el ie, pone el user y pass y peta, tb con estos ultimos cambios. Desisto jajaj y te dejo en paz, ya lo tengo funcional en firefox , asi que suficiente , gracias por toda tu ayuda elektro
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú# -*- coding: ISO-8859-1 -*-
require 'watir'
require 'watir-classic'
require 'win32/registry'
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")
# -*- coding: ISO-8859-1 -*-
require 'watir'
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}
"
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
C:\>ocra --output navegante.exe navegante.rb
=== Loading script to check dependencies
INFO:
[+] URL:
http://ggg.es/privado
[+] Usuario:
Atributo = name
Nombre = usuario
Texto = admin
[+] Contraseña:
Atributo = name
Nombre = clave
Texto = gfgfddf
[+] Botón:
Atributo = tag_name
Nombre = Acceder
[+] Link 1:
Atributo = text
Nombre = Actualización
[+] Link 2:
Atributo = text
Nombre = Exportar Artículos Ahora
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/elemen
t.rb:66:in `assert_exists': Unable to locate element, using {:tag_name=>"Acceder
"} (Watir::Exception::UnknownObjectException)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-c
lassic/element.rb:419:in `perform_action'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-c
lassic/element.rb:276:in `click!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-c
lassic/element.rb:218:in `click'
from C:/navegante.rb:59:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:1146:in `lo
ad'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:1146:in `<t
op (required)>'
from C:/Ruby193/bin/ocra:23:in `load'
from C:/Ruby193/bin/ocra:23:in `<main>'
C:\>
Citarque trabajo me das en realidad es culpa mía por no prevenir una posible incompatibilidad de caracteres xD