Half-width katakana characters are not garbled when using python + selenium execute_script

Verification environment

--Windows 10 Pro, 64bit Version 2004 Build 19041

Samples using send_keys and execute_script respectively

[Selenium] When the character input of SendKeys is slow, enter it with "executeScript" for a moment \ | Selenium Note.

<NG>send_Use keys (garbled pattern)


el = driver.find_element_by_id('target_id')
el.send_keys('Mojibake Mojibake')

<OK>execute_Use script (can avoid garbled characters)


driver.execute_script(
  'document.getElementById("target_id").value="%s";' %
  'Mojibake Mojibake!'
)

Articles found on why half-width katakana characters are garbled

I haven't digged deep into it, but it says that IE's WebDriver can be patched. Chrome Driver does not seem to have a public repository.

-[2019/05 article] [[Selenium] What to do when half-width katakana is garbled on Windows \ | Engineer's sleepless night](https://sleepless-se.net/2019/05/16/selenium -windows-input-hankaku-kana-error /) -[2013/09 article] Selenium WebDriver -Enter half-width kana with SendKeys: @jsakamoto

Recommended Posts

Half-width katakana characters are not garbled when using python + selenium execute_script
[EC2] Prevent garbled characters when capturing with selenium
What are you using when testing with Python?
When "Message: session not created" occurs in Python + Selenium
When there are multiple Selenium SeleniumBasic classes (Python VBA)
How to not load images when using PhantomJS with Selenium
Note links that may be useful when using Python, Selenium2
Start to Selenium using python
Web scraping using Selenium (Python)
[Python] Appears when using iterdir () etc. [Errno 20] Not a directory:'*** / .DS_Store'
[Web development with Python] Measures against garbled characters when outputting html
Precautions when using pit in Python
[Python] Be careful when using print
Precautions when using phantomjs from python
When using MeCab with virtualenv python
Precautions when using six with Python 2.5
[VS Code] ~ Tips when using python ~
When using regular expressions in Python
How to deal with the problem that Japanese characters are garbled when outputting logs using JSON log formatter