I programmatically create test accounts, and then immediately try to log in using a browser controlled by selenium. Unfortunately, the browser simply redirects to the facebook homepage. I can briefly see what seems like the right URL before redirecting, so I have no reason to believe that the browser is not going to where I intend it.
However, if you create a fake account and then just paste login_url into the browser, everything will work fine. Does anyone know why this might be unique in using Selenium here? Is there anything I need to do to prepare the browser for https connections or something else?
All I do is: (using capybara and the Selenium web driver)
visit @ fake_user.login_url
https://www.facebook.com/platform/test_account_login.php?user_id=100002152974488&n=ILRvb8Lqf2cq05t
GET / platform / test_account_login.php? User_id = 100002152974488 & n = ILRvb8Lqf2cq05t HTTP / 1.1 Host: www.facebook.com User-Agent: Mozilla / 5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: 1.9.2.15 ) Gecko / 20110303 Firefox / 3.6.15 Accept: text / html, application / xhtml + xml, application / xml; q = 0.9, /; q = 0.8 Accept-Language: en-us, en; q = 0.5 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-1, utf-8; q = 0.7, *; q = 0.7 Keep-Alive: 115 Connection: keep-alive
HTTP/1.1 302
Cache-Control: , -, no-store, must-revalidate
: , 01 2000 00:00:00 GMT
: http://www.facebook.com/
P3P: CP = "Facebook P3P. , : http://fb.me/p3p"
Pragma: no-cache
Set-Cookie: datr = d3J_TWSAN5uIXyh94O1YJkJ8; expires = Thu, 14-Mar-2013 14:06:47 GMT; =/; =.facebook.com; HttpOnly
Set-Cookie: lsd = -Lv-N; =/; =.facebook.com
Content-Type: text/html; = UTF-8
X-Powered-By: HPHP
X-FB-: 10.52.145.67
X-Cnection:
: , 15 2011 14:06:47 GMT
Content-Length: 0
http://www.facebook.com/
GET/HTTP/1.1
: www.facebook.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: 1.9.2.15) Gecko/20110303 Firefox/3.6.15
Accept: text/html, application/xhtml + xml, application/xml; q = 0,9,/; q = 0,8
Accept-Language: en-us, en; q = 0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1, utf-8; q = 0,7, *; q = 0,7
Keep-Alive: 115
:
Cookie: datr = d3J_TWSAN5uIXyh94O1YJkJ8; LSD = -LV-N
HTTP/1.1 200 OK
Cache-Control: , -, no-store, must-revalidate
: , 01 2000 00:00:00 GMT
P3P: CP = "Facebook P3P. , : http://fb.me/p3p"
Pragma: no-cache
Set-Cookie: reg_fb_gate = http% 3A% 2F% 2Fwww.facebook.com% 2F; =/; =.facebook.com
Set-Cookie: reg_fb_ref = http% 3A% 2F% 2Fwww.facebook.com% 2F; =/; =.facebook.com
-: gzip
Content-Type: text/html; = UTF-8
X-Powered-By: HPHP
X-FB-: 10.52.163.25
X-Cnection:
-: chunked
: , 15 2011 14:06:47 GMT