Is there any way of to login via the browser to facebook and google, but without using the provided APIs? So far I have tried mechanize
with cookielib
, webbrowser
, requests
and selenium
, but I did not get any satisfying results. The closest I got was to log in using mechanize + cookielib
but via command line. I have an app and all what I want it to do is to open a browser and open either the facebook or the google page and to automatically log me in using the provided user name and password.
Note: if this can be done more easily in a different language, I am interested in those too.
Thanks in advance for your help!
Log-In Facebook / Option #1 - Socket:
Log-In Facebook / Option #2 - Browser:
In order to install Selenium for Python on your machine, run 'pip install selenium' from a command line.
Log-In Email / Option #1 - Socket:
Log-In Email / Option #2 - Browser:
Just follow the instructions for 'Log-In Facebook / Option #2'.
In order to find the xpath of the elements, open the page in a web-browser and inspect each element.
If you are on Mac OS X, one potential solution is to combine Python with Applescript, via the appscript Python module:
https://pypi.python.org/pypi/appscript
For example, Clark Goble posted an example Python script that automatically fills out a form on FedEx's website:
http://www.libertypages.com/clarktech/?page_id=1570
The key is the
Safari.do_JavaScript
statements, which allow you to have the browser navigate the page's DOM and submit information via Javascript. (You could also do the whole thing in Applescript, but I've found using appscript is generally easier.)