Webwhatsapp-wrapper: AttributeError

Created on 19 Mar 2018  路  5Comments  路  Source: mukulhase/WebWhatsapp-Wrapper

Hi:
This error has been thrown when Chrome browser has been launched. Could you please help me solve this? Thanks a lot !

driver = WhatsAPIDriver(client='chrome')

File "/Users/Nolan/anaconda/lib/python3.5/site-packages/webwhatsapi/__init__.py", line 227, in __init__
self.connect()

File "/Users/Nolan/anaconda/lib/python3.5/site-packages/webwhatsapi/__init__.py", line 232, in connect
local_storage_file = os.path.join(self._profile.path, self._LOCAL_STORAGE_FILE)

AttributeError: 'Options' object has no attribute 'path'

help needed

Most helpful comment

Hi, the problem is that profile management is not imlpemented for ChromeDriver. It's better to use GeckoDriver. I don't test ChromeDriver.

Workaround:

You can use autoconnect=False. And set url manually, avoiding to use connect method.

driver = WhatsAPIDriver(client='chrome', autoconnect=False)
driver.driver.get(driver._URL)

All 5 comments

btw, I'm working in this environment:

Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin

ChromeDriver 2.37 for macOS

Hi, the problem is that profile management is not imlpemented for ChromeDriver. It's better to use GeckoDriver. I don't test ChromeDriver.

Workaround:

You can use autoconnect=False. And set url manually, avoiding to use connect method.

driver = WhatsAPIDriver(client='chrome', autoconnect=False)
driver.driver.get(driver._URL)

@NolanWang was this issue resolved?

@kevinkit This issue with chrome still exists but the solution proposed by alfred82santa works just fine if you are not trying to store the profile.

Alternatively, if trying to store the whatsapp web profile for consistent login, you could also just add a profile yourself:

profile_path = 'C:\\Users\\ .... ' # desired profile location (must exist in the system)
myChromeDriver = WhatsAPIDriver(client='chrome', profile=profile_path, autoconnect=False)
myChromeDriver._profile.path = profile_path
myChromeDriver.connect()

@kevinkit This issue with chrome still exists but the solution proposed by alfred82santa works just fine if you are not trying to store the profile.

Alternatively, if trying to store the whatsapp web profile for consistent login, you could also just add a profile yourself:

profile_path = 'C:\\Users\\ .... ' # desired profile location (must exist in the system)
myChromeDriver = WhatsAPIDriver(client='chrome', profile=profile_path, autoconnect=False)
myChromeDriver._profile.path = profile_path
myChromeDriver.connect()

I am using chrome. I tried these steps exactly still my problem is not solved. I am getting the same error

Updated:
I fixed the problem by creating a new attribute "path" for my driver object.

what I did,

  1. Added path = None in webwhatsapi\__init__.py under the line _profile = None
  2. Then headed to connect() method and added path = self.path in 1st line.

Now it works fine for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juancrescente picture juancrescente  路  4Comments

mhndm picture mhndm  路  3Comments

dafner picture dafner  路  6Comments

EdisonHundLucas picture EdisonHundLucas  路  6Comments

dmreinoso picture dmreinoso  路  3Comments