Closed rohitf closed 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.
@dhruvramani wouldn't it be a better idea to use messenger.com
rather than facebook.com
url ?
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.
There is a button. The first icon works the same as add file option in facebook.com
. (Not just for images but all files)
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
.
I got your point. No luck in finding username on messenger webpage.
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 access
facebook.com/messages/
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.
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.
Great!
@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.
@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.
I switched to chrome, it should make the experience faster. Please check it out now
I also got the ElementNotVisibleExecption: Message : element not visible
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.
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."