1

I am using Selenium + Python to launch Firefox with an existing profile, not a temporary profile as by default. I have noticed that for any profile that I have used with Selenium, Japanese input is henceforth broken. Not just while Firefox is controlled from Selenium, but also afterward when I launch Firefox normally.

By "broken", I mean that if I type either in an input field on a web page, or in the url bar, or in the developer console, nothing happens at all. No Japanese or Latin characters appear. If however I go back to my default French input, then it works fine.

The issue is clearly at the level of the Firefox profile : Japanese input works fine in other programs, and works fine for other Firefox profiles.

My current workaround is to have a profile reserved for Selenium, but I'd like to fix my other profiles at least.

I don't expect someone will have a ready-made solution, but I would appreciate any clue, I don't even know in which direction to search right now.


Technical details :

I'm currently on Debian testing, Firefox 102 ESR, fcitx5 + anthy for Japanese input. But I noticed the same issue on Ubuntu 20.04, Firefox 104, ibus + anthy for Japanese input.

Steps to reproduce :

In Firefox, from about:profiles, create a new profile, and click "Launch profile in new browser". Notice that I can type in Japanese just fine. Close the browser.

Launch the same profile with Selenium using the following script :

#!/usr/bin/env python3

from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options

options = Options()
options.add_argument('-profile')
options.add_argument('/home/user123065/.mozilla/firefox/<randomstring>.<profilename>')
driver = Firefox(
    options=options
)

Notice that I can't type in Japanese. Close the browser, open it again without Selenium by clicking "Launch profile in new browser". Notice that I still can't type in Japanese.

user123065
  • 113
  • 6

1 Answers1

0

After lots of trial and errors, I found that editing the file user.js, replacing user_pref("focusmanager.testmode", false); with user_pref("focusmanager.testmode", true); fixed the issue.

No idea why.

EDIT :

10 month later, after an "apt update", the same issue appeared again. This time, the opposite modification fixed it. Still no idea why.

user123065
  • 113
  • 6