mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.19k stars 1.52k forks source link

Firefox opened from Selenium do not accept special characters #1786

Open ricardofantin opened 4 years ago

ricardofantin commented 4 years ago

System

Testcase

geckodriver.log

In the same directory of a Firefox binary run the code inside a python console.

!/usr/bin/python3

import urllib.request urllib.request.urlretrieve ("https://github.com/mozilla/geckodriver/releases/download/v0.27.0/geckodriver-v0.27.0-linux64.tar.gz", filename="geckodriver-v0.27.0-linux64.tar.gz") import tarfile filename = "geckodriver-v0.27.0-linux64.tar.gz" tar = tarfile.open(filename, "r:gz") tar.extractall() tar.close() from selenium.webdriver import Firefox from selenium.webdriver.firefox.options import Options opts = Options() opts.log.level = "trace" driver = Firefox(executable_path='./geckodriver', firefox_binary='./firefox', options=opts)

After execute the script, try to type any special character (á, é, í, ó, ú) in Firefox address bar or other form, it do not work (but it accept pasted special characters (Crtl+V)). I tested with Ubuntu and with other Firefox and geckodriver versions, they do not accepted special characters too (this is not a regression).

The same Firefox accept special characters when opened not from Selenium.

Stacktrace

(No stacktrace, the program do not crash)

Trace-level log

Appended.

whimboo commented 4 years ago

That works fine for me on MacOS. Mind telling us which keyboard layout (including language) you have setup? If you have a special one, could you try with the default en_US one?

ricardofantin commented 4 years ago

Keyboard layout pt_BR-ABNT2 ( https://upload.wikimedia.org/wikipedia/commons/f/f2/Qwerty_pt_BR-ABNT2.svg ) . It is a USB Keyboard.

I changed the layout to English and configured right alt to composition key to generate é (hold right alt, press ', release right alt, press e, generates é). Outside Firefox with Selenium it generates the é, inside Firefox with Selenium the composition key does not work. It is like I was not holding right alt when pressed the ' .