Bug 1016147: Make sendKeysToElement() respect caret position

This allows HTMLElement.send_keys() to insert text after the caret in
<input>.

Also, fix the test cast fail in test_text.py due to caret position was
not being considered.