I'm using Selenium Webdriver with python for running tests on a website.
python 2.7.2 with latest Selenium
I can't figure out how to send unicode such as German "Umlaute" (öäüß) to an input form. As far as I know webdriver can handle unicode so this might be a python problem.
# -*- coding: iso-8859-1 -*-
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.google.de")
i = u"hälp me"
driver.find_element_by_css_selector("INPUT[name=\"q\"]").send_keys(i)
This works without errors but does not send the "ä". Is there any further encoding/decoding required...?
Cheers
.send_keys()might work?google.desez it's encoded toISO-8859-1, so try.send_keys(i.encode('latin1').ISO-8859-1I should be good withi="hälp me"since my file is encoded# -*- coding: iso-8859-1 -*-but that throws an errorUnicodeDecodeError: 'utf8' codec can't decode byte 0x8a in position 0: invalid start byte.i.encode("latin1")doesn't work either - same errori.decode("iso-8859-1").encode("utf-8")with and without theuin the variable declaration. No success, I'm running out of ideas =(i = unicode(i, "utf-8")maybe?