zvovov / whatsapp-web

WhatsApp chat from [command line, terminal, console, cli] :no_mobile_phones:
MIT License
310 stars 76 forks source link

After login on whatsapp gets an error 'Unable to locate element' #13

Closed cibertuti closed 6 years ago

cibertuti commented 6 years ago

Hi, I install the script on my MacOs High Sierra, when I run the script and scan the qr code, when I see the chat list press 'y' at the 'question phone connected?' at the console and gets the error:

'Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="main"]/header//div[contains(@class, "chat-main")]"} (Session info: chrome=64.0.3282.140) (Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.13.3 x86_64)

    Chromedriver Error. Read the above error (if any), then
    Check if installed chromedriver version is compatible with installed Chrome vesion.'

Any ideas? Thank you

nzurita commented 6 years ago

+1, similar issue here in Ubuntu 16.04. As Firefox has released new versions, do you plan to release a new version compatible with Firefox?

File "chat.py", line 210 sys.exit(print(e, decorateMsg("\n\tChromedriver Error. Read the above error (if any), then\n\tCheck if installed chromedriver version is compatible with installed Chrome vesion.", bcolors.WARNING))) ^ SyntaxError: invalid syntax

VanityR commented 6 years ago

+1, Same issue

PiPauwels commented 6 years ago

This issue isn't Chromedriver related, it's due to some code changes in the webversion of WhatsApp itself. I'll have a patch ready today. I must add that I am a brand new Github user, so am I supposed to create a fork if I want to patch a project of which I am not the author?

VanityR commented 6 years ago

Unfortunately in the same boat - new user myself.

I assumed that it was due to DOM changes as I was trying out the xpath selectors manually and obviously they had no match.

I was in the process of manually specifying them(to which end I managed to send messages but not receive them - but I was just fiddling during down time, plus I'm not familiar with python).

Sorry I can't be of any further help! Best of luck :)

On 22 Feb 2018 15:40, "PiPauwels" notifications@github.com wrote:

This issue isn't Chromedriver related, it's due to some code changes in the webversion of WhatsApp itself. I'll have a patch ready today. I must add that I am a brand new Github user, so am I supposed to create a fork if I want to patch a project of which I am not the author?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zvovov/whatsapp-web/issues/13#issuecomment-367720769, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad44ijhfAdVjCgOrIfLW0AtTTZymZpgHks5tXYpVgaJpZM4R_wVp .

PiPauwels commented 6 years ago

I've created a fork with some small code changes: https://github.com/PiPauwels/whatsapp-web

The current code will:

Receiving messages is not yet working. In the original code, this is based on an attribute "data-id", to check whether a message has already been printed by the script. This attribute seems to have been removed from the web-version of WhatsApp, so it's nog longer possible to use this (so currently, the script isn't detecting new messages as being "new" ; yielding zero results). We'll have to figure out another way to detect whether messages have been printed.

PiPauwels commented 6 years ago

Update: the most recent version of my fork is now able to receive messages, as well as send them: https://github.com/PiPauwels/whatsapp-web

Since the receiving mechanism was based on an attribute "data-id", which has been omitted during recent DOM-changes, the new mechanism is now based on the name of te sender and the contents of the message (if both differ from the previous last printed message, new messages are printed to the screen). I've also incorporated the timestamp and sender name present in the current DOM, which is -IMHO- more useful than printing the group name in front of every message.

There remains one problem, which has something to do with another reported issue: https://github.com/zvovov/whatsapp-web/issues/4. At random times (not yet sure what causes the exception) that same exception is thrown, after which receiving messages is nog longer possible, but sending them keeps working. I will investigate this up next.

Planning on incorporating images & emoji once I get that bug out of the way.

zvovov commented 6 years ago

Should be fixed now. @PiPauwels brilliant work!