shauryauppal / PyWhatsapp

Python Automation using selenium & Scheduling of messages and media
https://www.linkedin.com/in/shaurya-uppal
Apache License 2.0
455 stars 159 forks source link

Sending message to contact or group which name contain emoji #58

Open yashlande opened 4 years ago

yashlande commented 4 years ago

I try this script and like and it is very good but I occur one issue ie if group name or contact name contain emoji or unicode character then script not find out contact. for e.g. I have one contact "🚩 जय शिवराय महाराष्ट्र 🚩, 🚩 King Group 🚩" this type of contact name not found by script and it is not possible to send message through script.

shauryauppal commented 3 years ago

Hi @yashlande chrome driver only supports BMP. I am not sure if this is possible to solve. https://stackoverflow.com/questions/59138825/chromedriver-only-supports-characters-in-the-bmp-error-while-sending-emoji-with

nitinkumar30 commented 1 year ago

Hi @yashlande chrome driver only supports BMP. I am not sure if this is possible to solve. https://stackoverflow.com/questions/59138825/chromedriver-only-supports-characters-in-the-bmp-error-while-sending-emoji-with

I think this can be implemented with some integration. Try to apply the following code. Avoid using send_keys.

js_code = """
  var elm = arguments[0], txt = arguments[1];
  elm.value += txt;
  elm.dispatchEvent(new Event('change'));
"""

your_text = '🚩 जय शिवराय महाराष्ट्र 🚩'
element = driver.find_element_by_xpath('//*[@data-testid="input"]')
driver.execute_script(js_code, element, your_text)

I got this answer here.