Japanese (Mozc) input not working in browser created by Selenium

22 views Asked by At

I am currently learning Japanese and Webscraping so I thought this would be a perfect match together. But somehow when I type inside the new Firefox browser, which opened after following Code:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.service import Service

def open_firefox():
    """Open Firefox and navigate to google.com."""
    options = Options()
    options.add_argument('--no-sandbox')
    options.add_argument('--disable-dev-shm-usage')
    
    service = Service(executable_path="/snap/bin/geckodriver") # specify path to geckodriver
    driver = webdriver.Firefox(options=options, service=service)
    driver.set_window_size(1920, 1080)
    driver.maximize_window()
    driver.implicitly_wait(10)

    driver.get("https://www.google.com") # navigate to Google

if __name__ == "__main__":
    open_firefox()

it does not take the Japanese Mozc input, but still the normal "ABC" style input.

I have created some custom Mozc Shortcuts in order to switch to Katakana and Hiragana without needing to select it via Mouse. This Shortcut is not getting registered as well. If I switch the input manually, the input inside the Browser is still "ABC" and not the current Japanese Mozc input. But it does Work correctly outside the Browser.

I hope you understand this question. If not, please let me know.

I already updated my language in Settings, like described here:

https://askubuntu.com/questions/633110/ibus-anthy-mozc-works-in-every-program-except-for-chrome

but the problem remains.

I am currently running Ubuntu 22.04. LTS 64bit, Selenium Version: 4.18.1, Mozilla Firefox Version: 123.0.1 (Installed via pip)

0

There are 0 answers