dhruvramani / Terminal-on-FB-Messenger

Allows user to take full control of the terminal of their computer through Facebook's messaging service.
http://dhruvramani.github.io/Terminal-on-FB-Messenger/
407 stars 58 forks source link

Fails to log in to Facebook after populating username / password #1

Closed rohitf closed 8 years ago

rohitf commented 8 years ago

After entering the username / password in the terminal, it navigates to and populates the login fields on facebook.com but fails to login. It throws a Selenium error - "Message: Element is not currently visible and so may not be interacted with."

dhruvramani commented 8 years ago

It's most probably due to some changes in the CSS selectors (id, class, etc.) by Facebook. The last time I experienced the error, the id of the 'Log-In' button had changed. But, I checked recently, and there has been no change in the ID. So most probably you might have entered a wrong email/password, which causes it to load to a different page (the one which says forgot password).

I had experienced similar problems due to slow internet connection too, but that hardly matters.

Please re-run the script, and check. I'll add the error messages in the next commit, if log-in fails, and also, make sure that the CSS selectors used haven't been changed by Facebook.

manu-chroma commented 8 years ago

@dhruvramani wouldn't it be a better idea to use messenger.com rather than facebook.com url ?

dhruvramani commented 8 years ago

I don't think so, because to send a file through messenger, you have to drag it from the desktop to the browser window. There's no 'button' to which you can click on to send the file. That's why I think facebook.com is just right.

manu-chroma commented 8 years ago

image There is a button. The first icon works the same as add file option in facebook.com. (Not just for images but all files)

dhruvramani commented 8 years ago

Hmm, did you find a way to get the URL to chat with your own user using messenger? Mine is like : https://www.messenger.com/t/dhruv.ramani. I use facebook.com so that I can get the username. The username doesn't match with the actual name person, there are usernames like nolangreat. The name of the person is Nolan Simon Lewis.

manu-chroma commented 8 years ago

I got your point. No luck in finding username on messenger webpage.

manu-chroma commented 8 years ago

Hey, I've created a short script to get the facebook username using mechanize and `beautiful soupmodules. It's much faster than your current setup. And after you get the username, you can directly accessfacebook.com/messages/``. After login you will be automatically redirected. https://gist.github.com/manu-chroma/64ca625d929e89297b74

dhruvramani commented 8 years ago

Hmm, Thanks so much for that, but I really need to run it on python3. Could you add the code to existing source and send a PR? I am hardly gonna find the time to work on this from tomorrow.

manu-chroma commented 8 years ago

I can rewrite the code using similar library https://github.com/hickford/MechanicalSoup which supports python 3 as well. I'll implement the logic using this library and drop a PR over the weekend.

dhruvramani commented 8 years ago

Great!

araoxervmon commented 8 years ago

@rohitf try changing the code on line 64 driver.find_element_by_id('u_0_n').click() +++ driver.find_element_by_id('u_0_l').click() ---- If the above didn't work use firebug and check for login id and replace the element id in your code. @dhruvramani Nice work!! Somehow I feel it is better if we check the input id, element id u_0_l is a system generated I guess and it might change again.

fborcic commented 8 years ago

@manu-chroma if you implement it using MechanicalSoup, be sure to use m.facebook.com. It's way simpler and doesn't require javascript to work.

dhruvramani commented 8 years ago

I switched to chrome, it should make the experience faster. Please check it out now

pushpankar commented 8 years ago

I also got the ElementNotVisibleExecption: Message : element not visible

dhruvramani commented 8 years ago

Please check the IDs I have used are same as the actual ones by inspecting the 'Log In' button and the 'Reply' button when on the message button. If they aren't the same, change it.