Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook connect automated testing, recommedations?

Since so many sites use Facebook login/connect for authentication, does Facebook or others have a standard recommendation on how to automate clicking Facebook button to bring up popup, then switch to popup and login and go back to main window and check login successful and proceed from there?

While each website is different, the login process and FB button is pretty much the same for all. So I would think there should be boilerplate code that everyone can use to automate FB login for their site as part of their automated testing and save headaches trying to automate themselves.

I have experienced and see posts on having issues with FB connect trying to select the popup window to login, etc. for IE (and perhaps Safari).

If we don't, be nice to offer a recommended process on how to do the automation

  • with Selenium RC
  • with WebDriver
  • with the different bindings (Java, Python, Ruby, PHP, Perl, etc.)
  • with watir, watin, etc.
like image 211
David Avatar asked Apr 12 '12 21:04

David


1 Answers

What about something like

#
# Click on Facebook connect link
#
selenium.setSpeed("4000");  # wait for the new window to open
time to open.
selenium.selectWindow("window name");  # You will have to specify the window name here
selenium.windowFocus();
selenium.setSpeed("0");

# Now you should click the link 

#
# And get back to the previous window
#
selenium.setSpeed("4000");
selenium.selectWindow("");
selenium.windowFocus();
selenium.setSpeed("0");

I hope it helps, I'm not a Selenium power user, but this shouldn't be bad for your needs.

like image 78
Goles Avatar answered Sep 20 '22 04:09

Goles