Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.WAPI doesn't exist #1183

Open
andlb opened this issue Sep 8, 2023 · 2 comments
Open

window.WAPI doesn't exist #1183

andlb opened this issue Sep 8, 2023 · 2 comments

Comments

@andlb
Copy link

andlb commented Sep 8, 2023

Does anybody is having problem with new whatsapp version?

I got this error:

 42         :rtype: JsFunction
 43         """

---> 44 wapi_functions = dir(self)
45
46 if item not in wapi_functions:

TypeError: 'NoneType' object is not iterable

There isn't window.WAPI anymore.

@iaron
Copy link

iaron commented Sep 8, 2023

In my case I just changed the querySelector, I did this in wapi_js_wrapper.py so the script can be injected:

From:
result = self.driver.execute_script("if (document.querySelector('*[data-icon=chat]') !== null) { return true } else { return false }")

To:
result = self.driver.execute_script("if (document.querySelector('*[data-icon=default-user]') !== null || document.querySelector('*[data-icon=chat]') !== null ) { return true } else { return false }")

@andlb
Copy link
Author

andlb commented Sep 8, 2023

Thanks very much. I helped me a lot. I didn't know where to look. The final solution for me was that one:

result = self.driver.execute_script("if (document.querySelector('[data-icon=default-user]') !== null || document.querySelector('[data-icon=new-chat]') !== null || document.querySelector('*[data-icon=chat]') !== null ) { return true } else { return false }")

I added a new clause to data-icon=new-chat.

You may have to do that in the future too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants