The script below logs in using basic auth. I have got the script below to work with IE (see below). Is there a way I can do something similar with firewatir? I get the following error if I use firefox: =================== C:\svn\ruby\scrap>ruby 03.rb 03.rb:22:in `basic_auth': undefined method `send_keys' for #<FireWatir::Firefox: 0x3221174> (NoMethodError) from 03.rb:34 ===================
Alternatively, I could log in as: http://myusername:mypassw...@www.someplace.com However I still get a confirmation prompt that says: You are about to log in to the site "www.someplace.com" with the username "myusername". I don't know how to get rid of this confirmation box either. Either solution will be fine, but it would be great to be able to do this in firefox. Here is the basic auth script that works for internet explorer (it came from http://wiki.openqa.org/display/WTR/Basic+Authentication?focusedCommentId=18382879): require "watir" # To get this script to work: # Solution 1 (didn't work #require 'win32ole' # # Solution 2 (did work), enter: # cd "C:\ruby\lib\ruby\gems\1.8\gems\watir-1.6.2\lib\watir" # regsvr32 AutoItX3.dll class Login def basic_auth(secure_site_url) # Internet Explorer instance is called $ie, initialized elsewhere like so: #$ie = Watir::IE.new @user = 'myusername' @pass = 'mypassword' @url = secure_site_url a = Thread.new { $ie.goto(@url) } sleep 2 $ie.send_keys(@user) $ie.send_keys('{TAB}') $ie.send_keys(@pass) $ie.send_keys('{ENTER}') a.join end end #ie = Watir::IE.new $ie = Watir::IE.new url = "http://www.someplace.com" login = Login.new login.basic_auth(url) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---