Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8554059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:47:43+00:00 2026-06-11T14:47:43+00:00

Another watir issue. This code works until add_task … After login, the auth window

  • 0

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/fxdriver@googlecode.com/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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:47:44+00:00Added an answer on June 11, 2026 at 2:47 pm

    I believe that the problem is that after switching to the Sign In popup window, the script does not switch out of it. So during add_task when it tries to click the link, it is trying in the Sign In popup, which is closed.

    In the basic_auth method, you want to pass the actions you want performed in the popup as a block to the window.use method.

    So you want:

    $browser.window(:title, 'Sign In').use do 
        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
    

    (Notice the do added at the end of the first line and the extra end at the end.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

another newbie-question regarding rails and bootstrap. I am using something like this: <div class=tabbable
Another clipboard question: When text is put onto the clipboard, it frequently goes in
another sql problem of mine .. this time the reader doesn't work properly (
Another question related to this one . I have a List<SortableObjects> that is the
this question is based on answer got from another SO question, can be found
Put it another way: what code have you written that cannot fail. I'm interested
another in my beginnerish series of questions about VBA. I am in the process
another problem. I have already placed my Jython.jar into what my computer recognizes as
Another git question... I am in the following situation: A1 ---- B1 ---- C1
Another SO thread explains how to use thread::native_handle to do things that are outside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.