I'm trying to send a message using send_keys()
by picking a random item containing an emoji from a list:
gm = [
'Good morning ',
'Good morning ☀️',
'Good morning ⛅',
'Good morning ',
'Good morning ',
'Good morning ',
'Good morning ⛅',
'Good morning ️',
'Good morning ️',
'Good morning ☕',
]
Sending the text directly containing an emoji works fine like so:
textbox = driver.find_element(By.XPATH, textbox_xpath)
textbox.send_keys('Good morning ☀️' + Keys().ENTER)
But having it pick a random value from the list as the text input does not work and results in the error: selenium.common.exceptions.WebDriverException: Message: unknown error: ChromeDriver only supports characters in the BMP
.
textbox = driver.find_element(By.XPATH, textbox_xpath)
textbox.send_keys(random.choice(gm) + Keys().ENTER)
Any help would be appreciated.