I use splinter
to do functional tests for a website. The tests run well as long as I don't enter special characters, just as German Umlaute.
How can I tweak the script to test entries with these characters as well?
This is what I tried so far:
# coding=utf-8
from splinter import Browser
URL = "http://www.example.com"
USER = raw_input("Username, please: ") # f.e. "Günther"
with Browser('') as browser:
# Log in as administrator
browser.visit(URL)
browser.fill('user', USER)
This is the error log I get:
Traceback (most recent call last):
File "test.py", line 47, in <module>
browser.fill('user', USER)
File "C:\Python27\lib\site-packages\splinter\driver\webdriver\__init__.py", line 230, in fill
field.value = value
File "C:\Python27\lib\site-packages\splinter\driver\webdriver\__init__.py", line 338, in _set_value
self._element.send_keys(value)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 293, in send_keys
self._execute(Command.SEND_KEYS_TO_ELEMENT, {'value': typing})
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 370, in _execute
return self._parent.execute(command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 164, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 344, in execute
data = utils.dump_json(params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\utils.py", line 30, in dump_json
return json.dumps(json_struct)
File "C:\Python27\lib\json\__init__.py", line 243, in dumps
return _default_encoder.encode(obj)
File "C:\Python27\lib\json\encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Python27\lib\json\encoder.py", line 270, in iterencode
return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x81 in position 0: invalid start byte