SeleniumLibrary
SeleniumLibrary copied to clipboard
Input Text keyword fails on specific letters when using chrome and exported display
This issue may be related to https://github.com/robotframework/SeleniumLibrary/issues/1873. The root cause of the issue may not be in Selenium Library at all, but I haven't been able to isolate it any further than that at this point.
When using Input Text with chrome and an exported X11 display, some input characters cause problems with the resulting element values. For example, the character r
will cause the text to be truncated. The character e
will cause the e
and the character before it to go missing. The problem does not occur when using firefox.
I've included a screenshot using the test code in the issue reproduction section below. The first text box should contain the string abcdefg
, and the second should contain opqrstu
.
I've tried numerous combinations of characters and string lengths. The results have always been consistent in regards to how each problematic character behaves. I have verified the issue is not just a rendering issue by using Get Element Attribute to read back the values.
Robot does not log any failures and thinks everything is fine.
Steps to reproduce the issue
I've removed as many variables as possible from this test. Instead of using a web server and application, I can produce the problem using just a simple html file named robot.html
:
<html>
<body>
<input type="text" name="username" id="username">
<input type="text" name="password" id="password">
</body>
</html>
I've created the following robot file, named test.robot
:
*** Settings ***
Library SeleniumLibrary
*** variables ***
${URL} file:///tmp/test.html
${Browser} chrome
*** Test Cases ***
Testing with Browser
Open Browser ${URL} ${Browser}
Set Window Size ${640} ${480}
Sleep 3s
Input Text id:username abcdefg
Sleep 3s
Input Text id:password opqrstu
Sleep 5s
Close Browser
I then just run robot test.robot
.
Note, I am running robot on an AlmaLinux 8.8 VM with the display exported to the host. The behavior is the same when running headlesschrome and the display still set to the host's display. However, if I unset the DISPLAY variable, headlesschrome then works correctly.
The host is running macOS 12.7.1 and XQuartz 2.8.5.
Expected behavior and actual behavior
When I follow those steps, I see...
The first text box should contain the string abcdefg
, and the second should contain opqrstu
. However, as visible in the screenshot, the two text boxes instead contain abcfg
and opq
, respectively.
Environment
Browser: Google Chrome versions 114.0.5735.90, 120.0.6099.71, 120.0.6099.109 Browser driver: chromedriver versions 114.0.5735.90, 120.0.6099.71 Operating System: VM - AlmaLinux 8.8, Host - macOS 12.7.1 with XQuartz 2.8.5
Libraries (on VM)
- Robot Framework: 6.1.1
- Selenium: 4.16.0
- SeleniumLibrary: 6.2.0
- Python: 3.11.6