anupammaurya6767 / Demon_connect

👿 Demon : Whatsapp API
https://demon-connect.readthedocs.io/
MIT License
33 stars 6 forks source link

Error name 'Service' is not defined #9

Open muhbianco opened 7 months ago

muhbianco commented 7 months ago

📝 Describe the bug

Traceback (most recent call last): File "D:\playwrite_project\demon.py", line 7, in whatsapp_demon.login() File "D:\playwrite_project\venv\Lib\site-packages\demon_connect\whatsapp_api.py", line 156, in login login_whatsapp(self) File "D:\playwrite_project\venv\Lib\site-packages\demon_connect\features\login\login_whatsapp.py", line 30, in login_whatsapp self.driver = webdriver.Chrome(service=Service(), options=self._chrome_options) ^^^^^^^ NameError: name 'Service' is not defined

🔄 To Reproduce

from demon_connect.whatsapp_api import Demon

Initialize the API

whatsapp_demon = Demon()

Log in to WhatsApp Web

whatsapp_demon.login()

Send a message

message = "heyy"

contact = "Grp"

whatsapp_demon.send_message(contact,message)

whatsapp_demon.delete_message(contact,message)

Send an image (provide the path to the image file)

image_path = r"C:\Users\raman\Downloads\aatman.jpg"

contact = "Grp"

whatsapp_demon.send_image(contact,image_path)

Send a video (provide the path to the video file)

video_path = "path/to/your/video.mp4"

whatsapp_demon.send_video(contact,video_path)

tag all in group

group_name = "Grp"

whatsapp_demon.tag_all(group_name)

@whatsapp_demon.event def on_message(chat): print(f"New message from {chat.name}: {chat.message}")

@whatsapp_demon.event def on_ready(): print("Demon is ready!")

chat = whatsapp_demon.open("Anupam Maurya")

chat.send("HI")

🚀 Expected behavior

No response

🌟 pywa version

No response

🐍 Python version

No response

💻 Operating System

No response

📚 Additional context

No response

muhbianco commented 7 months ago

from demon_connect.whatsapp_api import Demon

Initialize the API

whatsapp_demon = Demon()

Log in to WhatsApp Web

whatsapp_demon.login()

Send a message

message = "heyy"

contact = "Grp"

whatsapp_demon.send_message(contact,message)

whatsapp_demon.delete_message(contact,message)

Send an image (provide the path to the image file)

image_path = r"C:\Users\raman\Downloads\aatman.jpg"

contact = "Grp"

whatsapp_demon.send_image(contact,image_path)

Send a video (provide the path to the video file)

video_path = "path/to/your/video.mp4"

whatsapp_demon.send_video(contact,video_path)

tag all in group

group_name = "Grp"

whatsapp_demon.tag_all(group_name)

@whatsapp_demon.event def on_message(chat): print(f"New message from {chat.name}: {chat.message}")

@whatsapp_demon.event def on_ready(): print("Demon is ready!")

chat = whatsapp_demon.open("Anupam Maurya")

chat.send("HI")

error:

Traceback (most recent call last): File "D:\playwrite_project\demon.py", line 7, in whatsapp_demon.login() File "D:\playwrite_project\venv\Lib\site-packages\demon_connect\whatsapp_api.py", line 156, in login login_whatsapp(self) File "D:\playwrite_project\venv\Lib\site-packages\demon_connect\features\login\login_whatsapp.py", line 30, in login_whatsapp self.driver = webdriver.Chrome(service=Service(), options=self._chrome_options) ^^^^^^^ NameError: name 'Service' is not defined

Aryan863 commented 6 months ago

Hey @muhbianco . I am interested in this issue and would like to contribute. Can you please assign me this issue?

anupammaurya6767 commented 6 months ago

Hey @muhbianco . I am interested in this issue and would like to contribute. Can you please assign me this issue?

@Aryan863 go ahead

Aryan863 commented 6 months ago

I am trying to recreate the issue on my local machine. I was trying to send a simple text message using the API ,which worked only till the chat was open, but no message was typed and sent. Instead I got an error- "Failed to send a message to Documents: Message: stale element reference: stale element not found". Am i doing something wrong??. im1 im2