I would like to send a :heart:
emoji with selenium\'s send_keys()
from selenium import webdriver
from selenium.webdriver.support.ui imp
You can not do it directly. You need to do this via javascript. Once Javascript has been formatted properly, you need to notify listeners.
Before that, you need to find the unicode of any emoji you want to use. To get codepoint of any emoji, this website can be used: https://emojipedia.org/ Search for any emoji and at the bottom of the page, there will be the codepoint for it.
To convert codepoint to unicode for javascript, use following website: https://r12a.github.io/app-conversion/
Type the codepoint and copy the value in javascript box of it. Once, you have it, use JavaScript as follows:
JS_ADD_TEXT_TO_INPUT = """
var elm = arguments[0], txt = arguments[1];
elm.value += txt;
elm.dispatchEvent(new Event('change'));
"""
elem = driver.find_element_by_id('<Id of your webelement>')
text = u'\u2764'
driver.execute_script(JS_ADD_TEXT_TO_INPUT, elem, text)
2764 is unicode for heart emoji. Hope this helps for any kind of emoticons you want to insert to your whatsapp!
Edit: For more complex emoticons: You need to add multiple unicodes like Emoji for family :
Well,
Here is a workaround! Hope it works!
text_element = driver_trader.find_element_by_xpath('xpath')
text = '⚪
guys. I found a really simple but powerfull way to add emoji to whatsApp using Selenium
Message_box.send_keys(':emoji' u'\ue007') # You just have to enter the code cording to the next page
https://gist.github.com/hkan/264423ab0ee720efb55e05a0f5f90887