Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #4027 > unrolled thread
| Started by | Alex Lin <chiapon@gmail.com> |
|---|---|
| First post | 2011-05-06 03:48 -0500 |
| Last post | 2011-05-06 06:30 -0500 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.ruby
Watir is unable to click Facebook "Login" button after button.click is executed Alex Lin <chiapon@gmail.com> - 2011-05-06 03:48 -0500
Re: Watir is unable to click Facebook "Login" button after button.click is executed Eugen Ciur <ciur.eugen@gmail.com> - 2011-05-06 06:30 -0500
| From | Alex Lin <chiapon@gmail.com> |
|---|---|
| Date | 2011-05-06 03:48 -0500 |
| Subject | Watir is unable to click Facebook "Login" button after button.click is executed |
| Message-ID | <135e47df33fc9ccd27ad2145b40e66c2@ruby-forum.com> |
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/.
[toc] | [next] | [standalone]
| From | Eugen Ciur <ciur.eugen@gmail.com> |
|---|---|
| Date | 2011-05-06 06:30 -0500 |
| Message-ID | <10f5d38f4791f52d174b15b56e62c148@ruby-forum.com> |
| In reply to | #4027 |
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/.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.ruby
csiph-web