I've been playing with the Selenium C# framework and been trying to do a facebook login, but without any luck.
This is what i got so far (based on this post: Testing a Facebook Connect application using Selenium?). I can't get it to work though.
ISelenium sel = new DefaultSelenium("localhost", 4444, "*chrome", "http://facebook.com");
public void LoginWithEmailAndPassword(string email, string pass)
{
sel.Start();
sel.Open("http://www.facebook.com");
sel.ClickAt("//img[\\@alt='Facebook']", "User clicks on Facebook Login");
sel.WaitForPopUp("", "3000");
sel.SelectPopUp("");
sel.Type("email", email);
sel.Type("pass", pass);
sel.KeyPress("pass", "\\13");
sel.SelectWindow("null");
}
So if someone could provide me with some sample code for how to do this, or guide me in the right direction, it would be appreciated.
Resolved
By using the record feature of the Firefox Selenium plugin I got the id's and the functions i needed to get it working. The login button seemed to require an XPath definition, which I also got from the Selenium IDE.
ISelenium sel = new DefaultSelenium("localhost", 4444, "*chrome", "http://facebook.com");
public void LoginWithEmailAndPassword(string email, string pass)
{
sel.Start();
sel.Open("/");
sel.Type("id=email", email);
sel.Type("id=pass", pass);
sel.Click("//label[@id='loginbutton']/input");
}