Another watir issue. This code works until add_task
...
After login, the auth window closes and goes back to main window with login key. But I get this error:
hi there
testing add_task
[remote server] file:///var/folders/3w/b7rcpqfj7kl3wtv56jt99yx00000gn/T/webdriver-profile20120919-9069-1ua1lm9/extensions/[email protected]/components/command_processor.js:10212:in `unknown': Window not found. The browser window may have been closed. (Selenium::WebDriver::Error::NoSuchWindowError)
require 'rubygems'
require 'test/unit'
require 'watir-webdriver'
class Login
def basic_auth(logintype,usr,pwd)
$browser.goto("http://change.com")
$browser.link(:class,'joinchange').wait_until_present
join_link = $browser.link(:class,'joinchange')
join_link.click
$browser.window(:title, 'Sign In').wait_until_present
$browser.window(:title, 'Sign In').use
if logintype == 'fb'
$browser.link(:name, 'login-facebook id=').click
$browser.text_field(:id,'email').set(usr)
$browser.text_field(:id,'pass').set(pwd)
puts 'form submit'
sleep 3
$browser.form(:id,'login_form').submit
puts 'hello world'
else
$browser.text_field(:id,'lgnId').set('changes')
$browser.text_field(:id,'pwdId').set('letmeinnow')
sleep 3
$browser.form(:name,'LoginActionForm').submit
puts 'hi there'
end
end
def add_task
puts "testing add_task"
$browser.link(:class,'nextStep').click
end
end
$browser = Watir::Browser.new
login = Login.new
login.basic_auth('test','usr','pwd')
sleep 3
login.add_task