Watir is unable to click Facebook "Login" button after button.clickis executed

Discussion in 'Ruby' started by Alex Lin, May 6, 2011.

  1. Alex Lin

    Alex Lin Guest

    Hi,

    I tried to use Watir & ruby & IE9 to automate Facebook login but seems
    the "Login" button is protected by Facebook.
    Below is my code snip:
    ------------------------------------------------
    ie = IE.new
    ie.goto('http://www.facebook.com/login.php')
    ie.text_field:)id, 'email').value = @user
    ie.text_field:)id, 'pass').value = @pass
    ie.button:)name, 'login').click
    puts '*** debug string here ***'
    ------------------------------------------------
    When this code snip is executed, IE is opened and go to the login page,
    then the fields are filled. But the login button is not clicked. IE
    still displays the login page without being submitted.
    In the console, '*** debug string here ***' is printed directly. No
    error occurs.

    The same code in Google search page works fine.
    ------------------------------------------------
    ie.text_field:)name, 'q').value = 'watir'
    ie.button:)name, 'btnG').click
    ------------------------------------------------

    Does anyone encountered the same situation like me or anyone could give
    me any advice?

    Regards,
    Alex

    --
    Posted via http://www.ruby-forum.com/.
     
    Alex Lin, May 6, 2011
    #1
    1. Advertising

  2. Alex Lin

    Eugen Ciur Guest

    Re: Watir is unable to click Facebook "Login" button afterbutton.click is executed

    I don't know anything about watir, but I tried with mechanize a while
    ago and it worked fine. Here is my code for fb login;

    require 'mechanize'

    def fb_login
    agent = Mechanize.new
    page = agent.get('http://www.facebook.com')
    form = page.forms.first
    form.field_with:)name => 'pass').value = 'user'
    form.field_with:)name => 'email').value = 'pass'
    result = agent.submit(form)
    agent
    end


    ----
    http://blog.eugen.co

    --
    Posted via http://www.ruby-forum.com/.
     
    Eugen Ciur, May 6, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Max2006
    Replies:
    2
    Views:
    1,578
    Walter Wang [MSFT]
    Sep 19, 2007
  2. Dutt
    Replies:
    1
    Views:
    695
    Peter Bromberg [C# MVP]
    Feb 8, 2008
  3. Maung Aung
    Replies:
    1
    Views:
    270
    Jeremy Woertink
    Oct 16, 2007
  4. Ram Prasad
    Replies:
    0
    Views:
    129
    Ram Prasad
    Feb 18, 2008
  5. Anukul Singhal
    Replies:
    1
    Views:
    168
    Charley Baker
    May 15, 2008
Loading...

Share This Page