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

Cannot send message with picture #143

Open
dhmyess opened this issue Nov 30, 2023 · 1 comment
Open

Cannot send message with picture #143

dhmyess opened this issue Nov 30, 2023 · 1 comment

Comments

@dhmyess
Copy link

dhmyess commented Nov 30, 2023

Help,

I cant send picture, when using messenger.send_picture('image.jpg', "test sending image")
it just stuck on image, no text added and not send

when i try send message without images get error like these messenger.send_message("test")

2023-11-30 17:19:55,973 - root -- [INFO] >> Message sent successfuly to
2023-11-30 17:19:55,973 - WDM -- [INFO] >> ====== WebDriver manager ======
2023-11-30 17:19:56,036 - WDM -- [INFO] >> Get LATEST chromedriver version for google-chrome
2023-11-30 17:19:56,182 - WDM -- [INFO] >> Get LATEST chromedriver version for google-chrome
2023-11-30 17:19:56,279 - WDM -- [INFO] >> Driver [/home/dharma/.wdm/drivers/chromedriver/linux64/119.0.6045.105/chromedriver-linux64/chromedriver] found in cache
Traceback (most recent call last):
File "/home/dharma/Unduhan/ktp/halid/baru/wa.py", line 8, in
messenger = WhatsApp() # Inisialisasi objek WhatsApp di luar fungsi
^^^^^^^^^^
File "/home/dharma/.local/lib/python3.11/site-packages/alright/init.py", line 39, in init
browser = webdriver.Chrome(
^^^^^^^^^^^^^^^^^
File "/home/dharma/.local/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 70, in init
super(WebDriver, self).init(DesiredCapabilities.CHROME['browserName'], "goog",
File "/home/dharma/.local/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in init
RemoteWebDriver.init(
File "/home/dharma/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 275, in init
self.start_session(capabilities, browser_profile)
File "/home/dharma/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 365, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dharma/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 430, in execute
self.error_handler.check_response(response)
File "/home/dharma/.local/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
(session not created: DevToolsActivePort file doesn't exist)
(The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x55e6df3ae5e3
#1 0x55e6df0710b7
#2 0x55e6df0a7e55
#3 0x55e6df0a4b81
#4 0x55e6df0ef47f
#5 0x55e6df0e5cc3
#6 0x55e6df0b10e4
#7 0x55e6df0b20ae
#8 0x55e6df374ce1
#9 0x55e6df378b7e
#10 0x55e6df3624b5
#11 0x55e6df3797d6
#12 0x55e6df345dbf
#13 0x55e6df39c748
#14 0x55e6df39c917
#15 0x55e6df3ad773
#16 0x7f95e9c15044

@dhmyess
Copy link
Author

dhmyess commented Dec 20, 2023

xpath changes sometimes between 2 xpath
//[@id="app"]/div/div[2]/div[2]/div[2]/span/div/span/div/div/div[2]/div/div[1]/div[3]/div/div/div[2]/div[1]/div[1]/p
or
//
[@id="app"]/div/div[2]/div[2]/div[2]/span/div/span/div/div/div[2]/div/div[1]/div[3]/div/div/div/div[1]/div[1]/p

on xpath_map

def add_caption(self, message: str, media_type: str = "image"):
    xpath_map = {
        "image": "/html/body/div[1]/div/div/div[3]/div[2]/span/div/span/div/div/div[2]/div/div[1]/div[3]/div/div/div[2]/div[1]/div[1]",
        "video": "/html/body/div[1]/div/div/div[3]/div[2]/span/div/span/div/div/div[2]/div/div[1]/div[3]/div/div/div[1]/div[1]",
        "file": "/html/body/div[1]/div/div/div[3]/div[2]/span/div/span/div/div/div[2]/div/div[1]/div[3]/div/div/div[1]/div[1]",
    }

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

1 participant